Re: Quit a remote application
Re: Quit a remote application
- Subject: Re: Quit a remote application
- From: Deivy Petrescu <email@hidden>
- Date: Sat, 1 May 2004 19:45:34 -0400
At 7:36 PM +0200 5/1/04, Axel Luttgens wrote:
Gnarlodious wrote:
Entity Nigel Smith spoke thus:
tell application "System Events" of machine "eppc://nigel:pwd@127.0.0.1"
to exists process "Adobe Photoshop 7.0"
So I'm trying to quit Entourage on a remote machine.
tell application "System Events" of machine
"eppc://Rachel:bugaboo@Gnarlodious-Cube" to exists process "Microsoft
Entourage"
which works even though the disk isn't mounted (cool).
Now I want to extract the boolean, but this doesn't work:
set appState to (tell application "System Events" of machine
"eppc://Rachel:bugaboo@Gnarlodious-Cube" to exists process "Microsoft
Entourage")
So what's the trick?
It seems that one needs a tell block instead of a single tell statement:
tell application "System Events" of machine
"eppc://Rachel:bugaboo@Gnarlodious-Cube"
set X to exists process "Microsoft Entourage"
end tell
Don't ask me why.
But works here for me with various apps.
Next, I want to quit Entourage but this doesn't work (no response):
tell application "System Events" of machine
"eppc://Rachel:bugaboo@Gnarlodious-Cube" to tell application "Microsoft
Entourage" to quit
And neither does this:
tell application "Microsoft Entourage" of machine
"eppc://Rachel:bugaboo@Gnarlodious-Cube" to quit
which sends error "application not running" even though it is.
Tried here with BBEdit.
The second form (eg. "tell application "BBEdit"
of ... to quit") works, but afterwards comes a
complaint about the process not being found on
host.
Unless a dialog appears before quitting (for
example, because of an unsaved document).
Perhaps not really a problem, as it is possible to use a try block.
Same behavior with TextEdit.
Would be interesting to know why.
Axel
Not that long ago, I tried using "System Events"
instead of "Finder" with remote scripting, it
failed!
I was surprised when I saw a bunch of scripts
referring to " SE of machine eppc://...".
My experience with remote scripting is a mixed
blessing, sometimes things works flawlessly,
sometimes working scripts will not work!
However, I decided to give a try to SE and, it did work well.
I tried other scripts that would not work before and they did work as well.
To quit, I put the tell app in a tell remote
finder wrap and I have no problem.
Using terminal as example.
tell app "Finder" of machine eppc://xxx.xxx.xxx.xxx
do stuff or nothing
tell app "Terminal of machine eppc://xxx.xxx.xxx.xxx to quit
do stuff or nothing
end tell
The problem was some scripts that were working
stopped working. So I could not launch Terminal
anymore.
Then, since SE was working I tried remote UI
scripting, but with no hope of getting something
out of it. To my surprise, it works!
Great job, AppleScript folks.
Actually the following script launches my terminal remotely
tell application "System Events" of machine eppc://xxx.xxx.xxx.xxx
get every process whose visible is true
tell process "Dock"
tell button "Terminal"
click
end tell
end tell
end tell
I am really impressed!
You can type a TE document remotely, from Across
the Universe. Thanks Lennon &McCartney
By the way, if one defines
set remote_IP to xxx.xxx.xxx.xxx
and uses
("eppc://"&remote_IP)
instead of
eppc://xxx.xxx.xxx.xxx
the script will not compile.
Happy remote scripting to all of you.
--
Regards
Saudagues
Deivy
http://www.dicas.com
_______________________________________________
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.