I am trying to write a very simple script that will take a selection of tracks (with the same album name) and make them part of a compilation, but I can’t seem to find the correct command to set the compilation boolean to true.
I’m OK with writing the rest of the script but just cannot find a way to set this bit. The command
‘set compilation to true’ returns an error, and every website and forum I have searched on in the last few hours has returned a blank.
Anyone able to help me out a little here please?
Thanks in advance.
Maybe a syntax problem? This works for me:
tell application "iTunes"
set compilation of track 1 of playlist 1 to true
end tell
Thanks for the reply jj
Tried this but it still doesn’t seem to work
Here is the script in full. It compiles and runs without error, but that’s all.
===
tell application “iTunes”
set theSelection to selection of front window
if theSelection is not {} then
repeat with i from 1 to count of theSelection
set compilation of track i to true
end repeat
else
display dialog "Select some tracks then" buttons {"Shit"} default button 1 with icon 2 giving up after 5
end if
end tell
===
I tried with your exact wording and then as you see it here, no joy.
Strange
No, no. In your code, you are setting the compilation property of tracks 1 thru xxx, which are not necessary the selected ones.
The variable “theSelection” contains a reference to the selected tracks, a reference by id, eg “track id 737” (which is not necessary the same as “track 1” or “first track”)
tell application "iTunes"
set theSelection to selection of front window
--> eg, {file track id 975 of library playlist id 529 of source id 34 of application "iTunes"}
if theSelection is not {} then
repeat with i in theSelection
set compilation of i to true
end repeat
else
display dialog "Select some tracks then" buttons {"Shit"} default button 1 with icon 2 giving up after 5
end if
end tell
Ah, I see now. Doh!!
Thanks for the help again jj.
Learning all the time
