Jesse
Jesse

Reputation: 591

AppleScript with iTunes on a remote machine

I have a Cocoa-AppleScript project in XCode where I'm trying to send some commands to iTunes on a local network computer. For some reason this works:

tell application "iTunes" of machine "eppc://user:[email protected]"
    playpause
end tell

But this does not:

set remoteMachine to "eppc://user:[email protected]"
tell application "iTunes" of machine remoteMachine
    playpause
end tell

I get the error "Can't find remote machine." Any ideas?

Upvotes: 2

Views: 474

Answers (2)

Jesse
Jesse

Reputation: 591

OK I figured it out, or at least one way to do it. You can specify the application itself on the remote machine, like:

set theRemoteApp to application "eppc://user:[email protected]/iTunes"
using terms from application "iTunes"
    tell theRemoteApp
        playpause
    end tell
end using terms from

Upvotes: 1

sakra
sakra

Reputation: 65971

Try adding a named qualifier:

set remoteMachine to "eppc://user:[email protected]"
tell application "iTunes" of machine named remoteMachine
    playpause
end tell

Upvotes: 0

Related Questions