Applescript that searches for folders by name
The system works well, but because there is a live work folder and finished work folder for each of our clients and each of these has a folder action attached, our server is taking quite a hammering with System events using huge processor cycles.
Someone kindly came up with the script below for a stay open script that would check the folders every 30 seconds and change the folder labels, which would be perfect, but it only finds "Live Work" and "Finished Work" folders on the desktop, All our Client folders are actually on a xserve RAID, so I need to modify the script so it seaches all of the RAID for folders called "live work" or "finished work" and batch changes the colour label.. any ideas?
property LiveWorkFolder : "Live Work"
property FinishedWorkFolder : "Finished Work"
property NoColor : 0
property Orange : 1
property Red : 2
property Yellow : 3
property Cyan : 4
property Magenta : 5
property Green : 6
property Gray : 7
on idle
tell application "Finder"
repeat with d in folder LiveWorkFolder
set label index of d to Green
end repeat
end tell
tell application "Finder"
repeat with d in folder FinishedWorkFolder
set label index of d to Red
end repeat
end tell
-- rerun this routine for constant surveillance
return -- rerun by default every 30 seconds
-- return 10 -- rerun every 10 seconds
end idle
Powerbook 15.2, Mac OS X (10.4)
