remote itunes and Error: Cannot find process on host

I have this script to check if iTunes i running on one of my remote machines but when i run it i get the error: “Cannot find process on host”. Is there a way to make this work? I’m wanting to check if the process is running and then save it as a variable name.

set runningiTunes to {}
tell application "Finder" of machine "eppc://user:passwd@192.168.0.104"
	set runningiTunes to (name of every process whose name is "iTunes")
end tell
if runningiTunes is "iTunes" then
	return
else if runningiTunes is {} then
	tell application "iTunes"
		run
	end tell
end if

can someone help me?

You can try this:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

If anyone is still having problems remotely controlling an application be sure that “Remote Apple Events” is turned on in the Sharing preferences on the remote computer, otherwise it will not accept apple events from your computer.

Once Remote Apple Events was activated on my remote computer Jon’s suggestion above did launch iTunes for me.

I also discovered that you cannot tell a remote application to launch, you must tell the Finder to launch it. Then you can tell the remote application to do what you like.

jON bEEBE
BIG Images

I think I spoke a bit to soon. After trying to edit Jon’s script (posted above) the code line

tell application "iTunes" of machine remote_machine to launch

does not work. It is the next line

open (application file id "hook" as alias) 

that does the trick. If I try to replace “iTunes” with “FileMaker Pro” the script still opens iTunes. If I remove the “hook” as alias line then the script does nothing. What is the “hook” in the above code and how is it associated with iTunes? How can I find what to replace “hook” with so that another application such as FileMaker Pro will open instead?

And another problem I noticed. While iTunes does open if I run Jon’s script as is, the code following it:

 repeat 20 times
                         try
                              delay 1
                              --check to see if it really is open:
                              get (item 1 of (get name of processes whose name = "iTunes"))
                              return true
                         end try
                         --check for 20 seconds, if it hasn't launched in that time, quit checking
                    end repeat

does not recognize iTunes as launched, even when it is. If anyone has ideas as to why this is not working correctly and what needs to change for it to work correctly I would greatly appreciate the knowledge.

Just to outline my purposes of needing to access a remote application: I need to verify that FileMaker Pro is running on a remote computer and if it is not then launch the app and open a specified database. Then my script will access the database and do the work it needs.

Thanks for your time,
jON bEEBE
BIG Images

I clearly state in my code that telling the application to launch didn’t work (though I don’t know why) but telling the Finder to open the application file does work. To find the application file, I use the application’s creator code. For iTunes, the creator code is “hook”. For FileMaker Pro, it depends on the version. For FMP 5.x, it is “FMP5”, for FMP v6.x, it is “FMP6”, and for FMP v7.x, it is “FMP7”. So, here’s a more generic bit of code for launching an application based on part of it’s name and the creator code:

Opening the specific database file (or checking to see if it is already open) is another matter…

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]