This is probably either a very simple question or an improbable one.
Selection is an application’s property according to iTunes’ dictionary and is r/o. Now, this may sound silly but if I want to designate a specific track, let’s say the current track, as a selection through script, without physically clicking the track in iTunes, would this be possible? And would I see that particular track highlighted in the iTunes’ window as if I actually clicked it?
TIA for any tip. I’ve been scratching my head and googled hard for any lead but I did not find any.
Although iTunes is very scriptable, I don’t think you can select tracks. You can select playlist though. Using selecting things is usually not a good idea anyway and I just work without it. You can ui script it using the Command + L combo.
tell application “iTunes” to activate
tell application “System Events”
tell process “iTunes”
keystroke “l” with command down
end tell
end tell
There are other ways, but this is easiest.
I almost forgot, but you probably know to chang ‘with command down’ to ‘using command down’ or something like that.
I was actually thinking of using the UI technique but just had perhaps the crazy thought that from somewhere, somehow one great tip would come out of the blue. Sigh :|.