I have 2 machines on the same network and I would like to run an applescript on machine a that will launch front row on machine b. I have checked remote apple events in the sharing pane of machine b and am trying this script. The middle part of the script works fine on machine a but I get a “cannot find process on host -600” error when I run the script. Why won’t this run?
global remMachine
-- change this to your username/IP:
set remMachine to "eppc://username:password@static ip of machine b"
set downArrow to ASCII character 31
set returnKey to ASCII character 13
set escapeKey to ASCII character 27
set leftArrow to ASCII character 28
set rightArrow to ASCII character 29
set upArrow to ASCII character 30
set downArrow to ASCII character 31
using terms from application "System Events"
try
tell application "System Events" of machine remMachine
key code 53 using command down -- launch front row
delay 8 -- give front row time to launch, adjust as needed
tell process "FrontRow"
-- do whatever keystrokes you want next
delay 4
keystroke returnKey
delay 4
keystroke upArrow
delay 1
keystroke returnKey
end tell
end tell
on error errM number errN
display dialog (errM & space & errN)
end try
end using terms from
“Front Row”… it’s 2 words I think.
I got the same error message
In general when you are using system events to perform keystrokes you don’t have to tell a process. Keystrokes always works on the frontmost application no matter what process you target, so my suggestion would be to just remove that statement.
In an effort to find the root of the problem.
I have successfully gotten machine b to create a new file using the finder
It appears the problem is the way I call Keystrokes
What is the syntax for keycodes using remote events?
global remMachine
set remMachine to "eppc://username:password@machine.local"
tell application "finder" of machine "eppc://username:password@machine.local"
using terms from application "System Events"
keystroke "1"
end using terms from
end tell
this does not work and is giving me “finder got an error: "1" doesn’t understand the keystroke message.”
The problem is not with keystrokes. I don’t have front row on my remote machine so I can’t test that but I can use keystrokes in TextEdit. I see the same “process” error you’re seeing if TextEdit is not already running. The application you send commands to must be running or you will see that error. So you’ll notice in my script I launch TextEdit first using the Finder because I know the Finder is always running, then I can do stuff with TextEdit.
set remMachine to "eppc://username:password@machine.local"
-- make sure TextEdit is running
using terms from application "Finder"
tell application "finder" of machine remMachine
open application file id "com.apple.TextEdit"
end tell
end using terms from
-- make sure TextEdit is frontmost
using terms from application "TextEdit"
tell application "TextEdit" of machine remMachine to activate
end using terms from
-- perform a keystroke
using terms from application "System Events"
tell application "system events" of machine remMachine
keystroke "my name"
end tell
end using terms from
Your problem must be in launching front row. Here’s my suggestion. Write a script to launch front row locally and save it as an application. Then put that application on the remote machine and make sure it works. Then using remote events you can launch that application on the remote machine from your local computer.
additional notes: System Events isn’t running either by default, so you must also launch System Events remotely.
This can be done with this trick
tell application "Finder" of machine eppc
get processes
end tell
the Finder knows the existence of the keyword processes, but asks System Events for the information.