views:

54

answers:

1

I am writing a mac application that uses the scripting bridge to control iTunes. I have generated the header file iTunes.h, and the SBApplication object can tell me all kinds of wonderful things.

However, the commands seem very limited. There is a 'playpause' function, but I see no way to do this

// iTunes is my SBApplication Object [iTunes play:@"Smoke On The Water"];

The Applescript to do this is the fairly simple

tell iTunes play songName

and this Scripting bridge is supposed to be the super cool and powerful way for me to control scriptable objects in Objective C, so what am I missing here?

+1  A: 

Search the web for equivalent AppleScript snippets or view iTune's scripting dictionary in the AppleScript Editor app. Then translate the resulting script into scripting bridge commands. A possible AppleScript equivalent is:

tell application "iTunes"
    play first item of (search first library playlist for "Smoke On The Water")
end tell

P.S. You might find objc-appscript easier to work with for this (or, if Objective C is not a requirement, its cousins, py-appscript or rb-appscript).

Ned Deily
+1 for suggesting sorting out the original Applescript and porting from there. That is the best way to find a solution to these various scripting bridge (py-appscript inclusive in that definition) problems.
Philip Regan
I am not sure what you mean by "translate the resulting script into scripting bridge commands". I understand the sample applescript, I just don't know how to execute applescript using the scripting bridge.
Tom Schulz