Hi,
This is just additional information on the topic. I was doing some more reading and searching on osascript, and I came across this script by James Nierodzik in #3 of http://macscripter.net/viewtopic.php?id=25499
After a bit of tinkering, I came up with this osascript command:
set osaCode to "'tell application \"Finder\" to set label index of item \"" & aNameTarget & "\" to \"" & LabelIndexSource & "\"'"
and this is the one script solution to my initial question:
set sourceFolder to (path to documents folder as text) & "Job Templates:Label Templates:"
set targetDefLoc to (path to documents folder as text) & "Jobs:"
set targetFolder to choose folder default location alias targetDefLoc with prompt "Choose the TARGET Job folder to set the labels."
tell application "Finder"
set sourceFileNames to name of every item of folder sourceFolder
set targetFileNames to name of every item of folder targetFolder
repeat with aName in sourceFileNames
set aNameSource to alias (sourceFolder & aName)
set LabelIndexSource to label index of aNameSource
if aName is in targetFileNames then
set aNameTarget to alias ((targetFolder as string) & aName)
set osaCode to "'tell application \"Finder\" to set label index of item \"" & aNameTarget & "\" to \"" & LabelIndexSource & "\"'"
tell current application
do shell script "osascript -e " & osaCode with administrator privileges
end tell
end if
end repeat
end tell
This, I think, is a neat and easy solution for using osascript without the need for a shell script.
Obviously, an osascript with a shell script is still the solution for more complicated scripts. McUsrII, thanks for pushing me to learn about it
Cheers, Chris