Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SilentPanda

Moderator emeritus
Original poster
Oct 8, 2002
9,992
31
The Bamboo Forest
Edit: I figured it out. Apparently I don't need the drive/directory qualifiers. Just iTunes was sufficient. But I'll leave the rest here for the "internet archival process". :)

So I'm just getting into Applescript and it's coming along well but I'm poking around on the way. I'm trying to get iTunes to activate on my laptop (I'm on my desktop). I have Remote Apple Events on but it won't activate it. The program is running and behind a Safari window. Here is the code:

Code:
activate application "Macintosh HD:Applications:iTunes" of machine "eppc://192.168.0.186"

I've tried using Macintosh \\HD just in case the space goofed it up, then I tried renaming the HD to MobileHD and updated the Applescript accordingly and still no dice. I keep getting this error (pictured below).

Certainly not urgent as I'm just poking around but more curious what I'm doing wrong here. The book I'm going through is "AppleScript Handbook" which was written for 10.3. Should still be okay but I know language things change from version to version too.
 

applelabs

macrumors member
Jan 9, 2007
75
0
It's been awhile but try this...

Code:
set computers_IP to "xxx.xx.x.x" -- your target computers local IP address
set the_computer to machine "eppc://" & computers_IP
tell application "iTunes" of the_computer
	using terms from application "iTunes"
		activate
	end using terms from
end tell

If that doesn't work try this...

Code:
set computers_IP to "xxx.xx.x.x" -- your target computers local IP address
set the_computer to machine "eppc://" & computers_IP
tell application "System Events" of the_computer
	using terms from application "System Events"
		tell application "iTunes"
           activate
           end
	end using terms from
end tell
 

simplebeep

macrumors member
Sep 28, 2007
43
0
SLC
Hmmm...

I tried this trick on some computers in a lab. All of them are using OS 10.2.8. When I run this code:
Code:
set theReply to display dialog "Computer number:" default answer ""
set thePrevious to the text returned of the result
set thePrevious to "eppc://1541-" & thePrevious & ".local"
set m to machine (thePrevious)

tell application "System Events" of m
	using terms from application "System Events"
		display dialog "Hello World"
	end using terms from
end tell
and enter the machine address, I get a message saying "System Events got an Error: Could not establish connection to host."

Both computers have remote apple events turned on and have been successfully networked in the past. What is wrong?

It's been awhile but try this...

Code:
set computers_IP to "xxx.xx.x.x" -- your target computers local IP address
set the_computer to machine "eppc://" & computers_IP
tell application "iTunes" of the_computer
	using terms from application "iTunes"
		activate
	end using terms from
end tell

If that doesn't work try this...

Code:
set computers_IP to "xxx.xx.x.x" -- your target computers local IP address
set the_computer to machine "eppc://" & computers_IP
tell application "System Events" of the_computer
	using terms from application "System Events"
		tell application "iTunes"
           activate
           end
	end using terms from
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.