Remote Scripting Solved !!!

My system and my settings

I have 2 systems running OS X 10.2.4 on a local network
Both have “Remote Apple Events” turned on in the Sharing control panel
Both have “Allow events from Mac OS 9” checked and a password set (I haven’t tested if this is absolutely required yet…it works with it on…)

Code Snippets

using terms from application "Finder"
	tell application "Finder" of machine "eppc://username:password@192.168.1.16"
		mount volume "afp://username:password@192.168.1.1/OSX"
		open folder "OSX:users:bob:documents"
	end tell
end using terms from

Here’s what’s happening in this script:
“Using Terms From” gets the application dictionary from the local system’s “Finder” app (I think).
Next, the remote machine (of machine) is told to use the “Finder” app. The last half of this line specifies the protocol (eppc://) then specifies the username and password separated by a colon WITHOUT SPACES. That is followed by the machine name. In this case an IP address. The user’s username and password are for an existing user on the REMOTE MACHINE. It is not required to have the username and password in the script. You can just use the protocol designator and the IP like this: “eppc://192.168.1.16”. However, you will be priompted to enter a username and password.
Yes, you WILL need the quotation marks in the script.

I mounted a volume on my “host” system. Same syntax as above.
The script will then open the specified folder on the remote machine which exists on the host machine.

Next example.

using terms from application "QuickTime Player"
	tell application "Quicktime Player" of machine "eppc://username:password@192.168.1.16"
		open file "OSX:users:bob:documents:TestMovie"
		export movie "TestMovie" to file "OSX:users:jason:QT_Finished:TestMovieFin" as QuickTime movie using most recent settings
	end tell
end using terms from

You will notice that this script is identical to the first with the exception of the app and the instructions for that app. However, an important thing to know here is that this script WILL NOT WORK UNLESS QUICKTIME PLAYER IS ALREADY RUNNING ON THE REMOTE SYSTEM. The first script works because the Finder is ALWAYS running.

In the “Export movie” line the word “file” is absolutely critical to have. The Quicktime Player dictionary does not make it obvious that it is required.

Other things of note

Remote scripting can fail !!!
If these scripts don’t work, open “Process Viewer” from the Utilities folder to see if AEServer is eating about 75% of your CPU. If so, reboot. None of your remote scripts will work if this is happening.

Remote scripting has been a big PAIN for me and I have found little help to solve it. I know others are in the same boat. I think I have truly solved this issue once and for all (except for the AEServer bug!)

Happy scripting !!!

THEJ

GREAT! I’ve been trying to figure this out for some time now. Thanks for posting this, I will get a lot of use out of it!

:smiley:

Thanks again!
Dave

thej, you should be worshipped as a god. Thanks for posting this how-to. I just totally freaked out a couple of PC-using fellow students by having an AppleScript load a web page on four different browsers on four Macs. Couldn’t have done it without you! :smiley: