My 11 year old son is building up an iTunes library on my wife’s iBook while he is saving for a NanoPod. I made a new user account for him, and supplied the following two scripts to transfer music files from the main user to his Drop Box. I set the permissions on his Drop Box to allow reading and writing by anyone.
This script moves the selected tracks from the main user’s iTunes into his drop box:
--Move music to another user's drop box
set this_track to {}
set drop_box to quoted form of "/Users/jamessmith/Public/Drop Box"
tell application "iTunes"
set this_track to (location of selection of browser window 1)
end tell
repeat with a from 1 to count (this_track)
set p_track to POSIX path of item a of this_track
set copy_track to quoted form of p_track
do shell script "cp " & copy_track & " " & drop_box
end repeat
He then switches to his account to run this script that imports the files into his iTunes and then empties the Drop Box folder:
--Import files from Drop Box into iTunes
set dbx_files to {}
set drop_box to "Macintosh HD:Users:jamessmith:Public:Drop Box"
tell application "Finder"
set dbx_files to every file in folder drop_box
end tell
repeat with b from 1 to count dbx_files
tell application "iTunes"
set ne_xt to item b of dbx_files as alias
add ne_xt to first library playlist
end tell
end repeat
tell application "Finder"
delete every file in folder drop_box
end tell
My problem is that I put both scripts into the Macintosh HD:Library:Scripts folder, so that both can be accessed under any user. Both scripts work fine, except that the second script WILL NOT work when run from the scripts menu bar in my son’s account. It only works if I open the script in Script Editor and run it from there.
Is there something about mulitple users that I am still missing? I would appreciate any and all ideas/comments.
Craig Smith