 |
 |
AppleScript: Remotely telling apps to quit
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Aug 2000
Location: Portland, Oregon
Status:
Offline
|
|
I have very limited scripting experience. I'd like to be able to remotely tell apps on my G4 to quit without using pkill. Do I use the remote "Apple Events" that are mentioned in the "Sharing" system settings? Can someone help get me started? Or is there an app out there already that lets me do this?
Thanks, I appreciate it.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status:
Offline
|
|
Assuming you have Remote Apple Events turned on (System Preferences -> Sharing -> Application) you can use AppleScript to control applications from a remote system.
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
Tell application <font color = red>"AppName"</font> of machine <font color = red>"remote machine name"</font> to quit
</font>[/code]
This will send a quit command to an application running on a remote machine.
|
|
Gods don't kill people - people with Gods kill people.
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Aug 1999
Location: Calgary, Alberta, Canada
Status:
Offline
|
|
I don't believe Mac OS X supports AppleEvents over AppleTalk. To send an AppleEvent over TCP/IP, use:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
tell application <font color = red>"Application Name"</font> of machine <font color = red>"eppc:<font color = brown>//the.ip.address/"</font> to quit</font>
</font>[/code]
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Aug 2000
Location: Portland, Oregon
Status:
Offline
|
|
Originally posted by King Chung Huang:
<STRONG>I don't believe Mac OS X supports AppleEvents over AppleTalk. To send an AppleEvent over TCP/IP, use:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre>& amp;lt;font size=1 face=courier>
tell application <font color = red>"Application Name"</font> of machine <font color = red>"eppc:<font color = brown>//the.ip.address/"</font> to quit</font>
</font></pre><HR></BLOCKQUOTE></STRONG>
It says:
Syntax Error. Couldn't get the application's event library.
Is that just because I'm testing it locally? I tried it with iTunes, Entourage, and TextEdit.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Aug 1999
Location: Calgary, Alberta, Canada
Status:
Offline
|
|
You need to surround the whole thing with "using terms from"
For example:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>set theTarget to application <font color = red>"SimpleText"</font> of machine <font color = red>"eppc:<font color = brown>//<font color = blue>127.0</font>.<font color = blue>0.1</font>/"</font></font>
using terms from application <font color = red>"SimpleText"</font>
tell theTarget
quit
end tell
end using terms from</font>[/code]
(edit: spelling mistake)
[ 11-06-2001: Message edited by: King Chung Huang ]
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|