PDA

View Full Version : concerning folder actions


VOX BARBARA
2004-06-14, 08:11
I'd like to add a particular folder action to a folder. This folder action script should label every ".pdf" inside the folder with a particular color, which i have choosed before. Example: if i drag a "pdf" into that particular folder, that pdf should change its label. Or, else, if i save a .doc document as a ".pdf" into the same folder (that one with folder action) the pdf should change its label. How to?

hints appreciated.

best

deeg
2004-07-02, 10:39
this any help ?

-- hacked apple droplet script to apply labels on pdf's via folder actions
property type_list : {"PDF"}
property extension_list : {"pdf"}

-- check for file or folder in added items and process as required
on adding folder items to this_folder after receiving added_items
repeat with i from 1 to the count of added_items
set this_item to (item i of added_items)
set the item_info to info for this_item
if folder of the item_info is true then
process_folder(this_item)
else if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
process_item(this_item)
end if
end repeat
end adding folder items to

-- this sub-routine processes folders
on process_folder(this_folder)
set these_items to list folder this_folder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as text) & (item i of these_items))
set the item_info to info for this_item
if folder of the item_info is true then
process_folder(this_item)
else if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
process_item(this_item)
end if
end repeat
end process_folder

-- this sub-routine processes files
on process_item(this_item)
tell application "Finder"
set label index of this_item to 1
end tell
end process_item



save it as a compiled script in your hd>library/scripts/folder actions, then on the menu bar script addition, under folder actions, there is a script to add your saved script to a folder... change the label index value to alter the colour (1 is orange for example)