set theFile to "Hard Drive:Users:wes:Documents:Automatic Duck:dev:install:file sets:AutoDuck Pro Import FCP:2.03:Installer Builds:Pro Import FCP 2.02C Site Install (Duck).app:"
tell application "Finder"
set label index of theFile to 6
end tell
… I get this error…
What do I need to change to be able to get this to work? Thank you.
Model: Dual 2.0 G5
AppleScript: Version: 2.0 (43.1)
Browser: Safari 312.5
Operating System: Mac OS X (10.4)
add the little word file and it works,
(you’re trying to change the label color of a literal string)
set theFile to "Hard Drive:Users:wes:Documents:Automatic Duck:dev:install:file sets:AutoDuck Pro Import FCP:2.03:Installer Builds:Pro Import FCP 2.02C Site Install (Duck).app:"
tell application "Finder"
set label index of file theFile to 6
end tell
I picked up this >15 year snippet which still works!
Than deleted the post because I managed to get 2 color labels but can’t seem to reproduce?
Reposting again because I have 2 questions
if I run multiple set label index only the last one seems to be applied.
How can I combine 2 string variables after for theFile
Applescript:
set theFile to "Macintosh HD:Users:anton:test.pdf"
-- set myPath to "Macintosh HD:Users:anton:"
-- set myFile to "test.pdf"
tell application "Finder"
set label index of file theFile to 4 -- blue
set label index of file theFile to 5 -- purple
-- set label index of file myPath & myFile to 6 -- gray
end tell
FWIW, using two separate set label lines works for me. Sometimes the finder window doesn’t update visually, at least not immediately. Dunno if that’s a factor here.
on mySetTag(myTag, myDir, myFile)
do shell script "/usr/local/bin/tag -a" & space & myTag & space & myDir & myFile
end mySetTag
mySetTag("Red,Yellow,Green,'Rasta Power'", "/Users/anton/Desktop/", "test.pdf")