Re: Osascript and ssh
Re: Osascript and ssh
- Subject: Re: Osascript and ssh
- From: Nigel Smith <email@hidden>
- Date: Fri, 30 Apr 2004 17:44:52 +0100
On 30/4/04 11:32, "Axel Luttgens" <email@hidden> wrote:
>
Well, it should. As a "proof" of the concept:
>
>
echo -n 'spawn ssh nigel@127.0.0.1 "sleep 10" ; expect "(yes/no)?" ;
>
send yes\r ; expect "password:" ; send nigelspass\r ; expect eof ' |
>
expect -d -
>
>
That quick and very dirty one-liner is to be used as the command line in
>
a xgrid shell job.
Couldn't get something similar to work as a one-liner when using "osascript"
as the command -- probably mucking up the quotes/escapes, but I got the
folowing executable to work:
#! /usr/bin/expect
spawn ssh nigel@127.0.0.1 "osascript /tmp/testTxt"
expect "yes"
send "yes\no)$"
expect "password:"
send $argv\n
interact
(Spotting the need for "yes/no)$" threw me for a while, until I started
logging everything!)
I can execute that script, passing the password as a parameter.
So now the Xgrid command writes an AppleScript file, writes the expect file,
changes permissions as appropriate, executes the expect file which logs into
localhost as someone else and gets osascript to execute the AppleScript
file, and then deletes the two files as clear up.
Phew!
It kind of works -- I think I need more error handling to give Photoshop a
little help, but that can wait until next week.
>
Just out of curiosity, what kind of limitations do you encounter with
>
Photoshop and eppc://?
On my machine -- 10.3.3 and Photoshop 7.0.1:
tell application "System Events" of machine "eppc://nigel:pwd@127.0.0.1" to
exists process "Adobe Photoshop 7.0"
--> true
tell application "Adobe Photoshop 7.0" of machine
"eppc://nigel:pwd@127.0.0.1" to open file
":Users:nigel:Desktop:oldxgride3test.tiff"
--> compile error "Application isn't running"
I call *that* a limitation :-)
>
Not sure whether the latter really is the right tool for what you
>
consider (after all, it is intended for distributed computing, not
>
really for remote control).
I'm looking for distributed processing -- "send this part of the job to any
machine that is available". The unit of processing just happens to be
"process an image in Photoshop" rather than "process this image with a
command line tool".
The joy of Xgrid is that it is ad-hoc. As machines come and go they can be
added or removed from the pool. You can even set the client to become
available after n minutes of sleep, which is ideal for a couple of the labs
here -- they can log in as the second user under Fast User Switching and
when they go off for coffee/lunch/meetings and the machine becomes idle it
will start processing some of their microscope images.
A good programmer would write custom utilities to do the image processing,
but I'll have to stick with Photoshop. But wouldn't it be great if it
worked?
Later,
Nigel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.