Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > AppleScript: Remotely telling apps to quit

AppleScript: Remotely telling apps to quit
Thread Tools
Fresh-Faced Recruit
Join Date: Aug 2000
Location: Portland, Oregon
Status: Offline
Reply With Quote
Nov 3, 2001, 10:16 PM
 
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
Reply With Quote
Nov 4, 2001, 02:13 PM
 
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
Reply With Quote
Nov 4, 2001, 02:38 PM
 
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
Reply With Quote
Nov 6, 2001, 05:12 PM
 
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:

&lt;BLOCKQUOTE&gt;&lt;font size="1"face="Geneva, Verdana, Arial"&gt;code:&lt;/font&gt;&lt;HR&gt;&lt;pre&gt;& amp;lt;font size=1 face=courier&gt;
tell application &lt;font color = red&gt;"Application Name"&lt;/font&gt; of machine &lt;font color = red&gt;"eppc:&lt;font color = brown&gt;//the.ip.address/"&lt;/font&gt; to quit&lt;/font&gt;
&lt;/font&gt;&lt;/pre&gt;&lt;HR&gt;&lt;/BLOCKQUOTE&gt;</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
Reply With Quote
Nov 6, 2001, 10:11 PM
 
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 ]
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:58 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2