jonn8
April 4, 2005, 5:44pm
#2
This should work for you as a Folder Action:
–Open this script in a new Script Editor window.
property the_extension : “.dv”
on adding folder items to this_folder after receiving these_items
repeat with this_item in these_items
set this_item to this_item as Unicode text
if this_item does not end with “:” or this_item does not end with the_extension then my [color=green]process_file/color
end repeat
end adding folder items to
on [color=green]process_file/color
tell application “System Events” to set name of (f as alias ) to (get name of (f as alias )) & the_extension
end process_file
Jon
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code ]
Nevermind, I fixed it. Thanks again so much. I learned a lot from your help.
jonn8
April 5, 2005, 2:52am
#5
You can get around renamed file=new file triggering the Folder Action conundrum by first moving the file to a subfolder and then renaming it. This will do that for you:
–Open this script in a new Script Editor window.
property the_extension : “.dv”
property converted_folder_name : “converted”
on adding folder items to this_folder after receiving these_items
repeat with this_item in these_items
set this_item to this_item as Unicode text
if this_item does not end with “:” and this_item does not end with the_extension then my process_file (this_item as alias , this_folder as Unicode text )
end repeat
end adding folder items to
on process_file (f , c )
tell application “Finder”
try
try
set converted_folder to (c & converted_folder_name & “:”) as alias
on error
set converted_folder to (make new folder at folder c with properties {name :converted_folder_name }) as alias
end try
set n to (get name of f )
move f to converted_folder with replacing
set name of ((converted_folder as Unicode text ) & n as alias ) to n & the_extension
on error e
activate
display dialog e buttons {“OK”} default button 1 with icon 0 giving up after 10
end try
end tell
end process_file
Jon
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code ]