[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] AppleEvents via Net? (spooky actions at a distance)



"Richard Johnson" <rjj@medialab.com> writes:
>I'm trying to use Mac Perl to fire up a set of distributed apps on idle
>workstations overnight.

Interesting project.

>I suppose I could just do the following:
>
>sub RenderLaunch {
>  MacPerl::DoAppleScript qq{
>    tell application "Finder" of machine "MarsObserver" of zone "Deimos"
>      open file "RenderAgent" of folder "Renderers" of folder \
>       "Extensions" of folder "System Folder" of startup disk
>    end tell
>  }
>}
>RenderLaunch;
>
>but that's AppleScript, and in raw form it brings up an annoying dialog asking
>for a password (which is not nice when I'm launching the thing with Cron while
>I'm on a river in my kayak :-).

Yes, I guess it must be tricky to balance the kayak with one hand on the paddle
while scribbling with the other hand the password on a MessagePad connected to
a cellular phone :-)

>Instead, I've been playing with code like the following:
>
>sub RenderLaunch {
>    $eventClass = "FNDR";
>    $eventID = "open";
>    $targetID = "0, $portName, $portlocation, null";

That line won't work like this. A targetID is some sort of binary structure,
not just a string (MacPack could probably help with that job).

>    $address = AECreateDesc typeTargetID, $targetID              || die $^E;
>    $event = AECreateAppleEvent $eventClass, $eventID, $address  || die $^E;
>    AEDisposeDesc $address                                       || die $^E;
>    $reply = AESend($event...
>}
>RenderLaunch;
>
>My current difficulties stem from finding a way to create $targetID (actually,
>find the port name and location) for a remote Mac.  (Is there an interface to
>IPCListPorts()?)

Not yet, I'm afraid. What's worse, this won't get rid of the authentication
dialog.

>Even better, is there a way to specify the authentication info (user name and
>password) for the program link on the remote machine, without popping up a
>dialog on an unattended machine?

How about installing Peter Lewis' Script Daemon on the remote machine? This
allows you to connect to the Telnet port (23) of the Machine, send the login
& password and then execute the AppleScript locally.

Matthias

-----
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "Evidently the cleaning lady found him slumped over his Macintosh"
                               -- Jay McInerney, _Brightness Falls_

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch