Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

using AppleScript to launch an application on a different machine

Hi there,

I'm trying to use AppleScript to enable a couple of my Macs to talk to each other.

On one machine, I want to use this script:

tell application "Finder" of machine "eppc://user:pass@helium.local"
launch application "Rivet" of machine "eppc://user:pass@helium.local"
end tell

to have the other machine launch Rivet, a video server that I can access from the PS3/iPhone/iPad

everything seems to work without issue (i.e. no errors), except it doesn't do anything.

I see a line written to the console on "helium":

9/23/10 18:48:30 com.apple.AEServer[3535] launchproxy[3535]: /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Versi ons/A/Support/AEServer: Connection from: xxx:xxx:xxx:xxx:xxx:xxx%en0 on port: 60571

every time I run the script on the other machine, but, like I said, nothing else happens.

Mac mini, Mac OS X (10.6.4)

Posted on Sep 23, 2010 6:50 PM

Reply
3 replies

Sep 23, 2010 8:54 PM in response to cyberwoozle

There are many possible causes for this. The most likely ones relate to access control.

For example, if UserA is logged into the GUI on helium.local, then only UserA can launch GUI-based applications. On that basis, if you use any other username in your remote commands they will fail.

Beyond that, I question why you're using the Finder at all. There's no need for it:

tell application "Rivet" of machine "epps://user:pass@helium.local" to activate


Even if you did target the Finder, there's no need for the second '... of machine...' statement since you're already focussed on the remote machine. As it stands you're telling the remote Finder to launch an application on a remote machine whereas what you want is to launch an application on the local machine (at least from the remote Finder's perspective).

Sep 24, 2010 11:18 AM in response to cyberwoozle

Hello

You might try this instead :

--SCRIPT
tell application "Finder" of machine "eppc://user:pass@helium.local"
open ("/Applications/Rivet.app" as POSIX file as alias)
end tell
(* Change the path "/Applications/Rivet.app" as is needed. *)
--END OF SCRIPT


*To tell Finder or System Events of remote machine to open remote application file is a tried and true method to launch remote application via remote Apple Events. As far as I know, you cannot directly tell remote application to launch or activate if it is not already running in remote machine.

Hope this may help,
H

Oct 30, 2010 9:40 AM in response to cyberwoozle

After much searching and trial and error I finally discoverd Hiroto's suggestion from way back in 2001. It is the only solution I have found that actually works to launch/activate any application on a remote Mac using an applescript on a local Mac.

I have one Mac Mini running household control applications Indigo and iRed. I wanted to use embedded AppleScripts in those applications to launch and control PandoraBoy on another MacMini that I use as a media center. I discovered that you cannot activate an application on a remote Mac unless it's already running. (Only God and Apple know why!) And, of course, if you want to launch and application--it's usually NOT running!

But the following works:


set remoteMachine to "eppc://RemoteMachineName:Password@192.168.1.115"
tell application "Finder" of machine remoteMachine
open ("/Applications/PandoraBoy.app" as POSIX file as alias)
end tell

THANK YOU HIROTO!!!

Once the remote app is actually launched/activated you can then send AppleScript commands to it as follows:

set remoteMachine to "eppc://RemoteMachineName:Password@192.168.1.115"
using terms from application "PandoraBoy"
tell application "pandoraboy" of machine remoteMachine
playpause
end tell
end using terms from

I have also learned that the application to be controlled on the remote machine must also be present on the local machine and "using terms from" must also be used in the control script for this to work.

using AppleScript to launch an application on a different machine

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.