logo       

Re: Mac::Glue script: msg#00102

lang.perl.macosx

Subject: Re: Mac::Glue script

Hi Chris,

Thanks for the input. I'll start working on it and see what I can come up with. One question: Is Mac::Sound a module? I've not heard of it.

Thanks,

Mark

On Apr 26, 2005, at 8:24 AM, Chris Nandor wrote:

In article <e609f105d8eef69c191f2386dc56ae2f@xxxxxxxxxxx>,
musicarr@xxxxxxxxxxx (Mark Wheeler) wrote:

The script will open Internet Connect, dial a number (given by the
script).

I don't know if you can do that with Internet Connect. This sorta works:

my $ic = new Mac::Glue 'Internet Connect';
my $conn = $ic->prop('BlueTooth configuration')->get;
my $status = $conn->prop('status');
my $state = $status->prop('state');

my $number = '*99#';

$conn->connect(to_telephone_number => $number) if $state->get == 0;

while (1) {
last if $state->get == 8;
sleep 1;
}

(That works for my Bluetooth modem, you can try it with 'PPP configuration'
too, I'm sure it should work the same.)

But in my test, it dials the main configuration no matter what the value of
$number. And I cannot select multiple configurations. (These are apparent
limitations in Internet Config itself, not Mac::Glue.)


When a connection is established, a sound file will be played
5 X (or what ever number of repetitions).

You can do this to some degree with Mac::Sound. I think you can't do it
with any old sound, that you need to have it in a resource file. The
Sound.t file shows an example. Another option is to use SysBeep(30) or
somesuch, to just get the system beep.


After the connection is lost
(phone is hung up after listening to the sound file), the connection is
closed, Internet Connect quits and the script ends.

Just keep checking $state->get until it is false, apparently. I didn't look
too hard to get an accurate and complete list of $state values. It's 0 when
not connected, 8 when connected, and 1-7 while in different connection
phases (dialing, authentication, etc.).

--
Chris Nandor pudge@xxxxxxxxx http://pudge.net/
Open Source Technology Group pudge@xxxxxxxx http://ostg.com/




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise