Retrieving GrageBand Track Names
Imported from the Apple Support Forums via the Wayback Machine 🔗
I'm trying to retrieve each Track Name in a GarageBand project via its "Track Number" property, however the returned values are not in the expected numerical order, nor have I been able to figure out a pattern for calculating which is which. The AppleScript bit is very simple:
tell application "GarageBand"
tell song 1
tell track 1
get Instrument name
return the result
end tell
end tell
end tell
With only 1 track in the project named "Track 1" the above works as expected, telling me that #1 is named "Track 1"
If I add a second track, "Track 2" and run the above script for each track i get
#1 "Track 2"
#2 "Track 1"
Adding a third:
#1 "Track 3"
#2 "Track 2"
#3 "Track 1"
The above looked promising, it appeared to simply be in reverse order, but then if I add a forth track:
#1 "Track 3"
#2 "Track 4"
#3 "Track 2"
#4 "Track 1"
and a fifth:
#1 "Track 5"
#2 "Track 3"
#3 "Track 4"
#4 "Track 2"
#5 "Track 1"
Here's what gets returned from 10 tracks (which, to be clear, are in numerical order from top to bottom in GarageBand, "Track 1", "Track 2', etc):
#1 "Track 7"
#2 "Track 9"
#3 "Track 8"
#4 "Track 5"
#5 "Track 10"
#6 "Track 3"
#7 "Track 4"
#8 "Track 2"
#9 "Track 6"
#10 "Track 1"
The only constant I notice is that the physical first track in GarageBand, "Track 1" is always returned as the last value, but I can't pick out a pattern for the rest. Can anyone see a pattern I'm missing, or is there another way of retrieving the index in the same order as the GUIs layout?
8 replies
Sign in or join Beachball Help to reply.
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 0