Hello again all,
Can any of you Script Wizards tell me where I am going wrong with this:
I can make my PBook beep when I add items but I really want to do a bit more…
on adding folder items to this_folder after receiving this_item
tell application "Finder"
set new_file to the item added --to this_folder
set pos_data to paragraphs of (read new_file)
--display dialog pos_data
repeat with i from 1 to the count of the items in the pos_data
set test_name to item i of the pos_data
if test_name starts with "U" then
copy "" to (item i of the pos_data)
else
set AppleScript's text item delimiters to ""
set new_name to (characters 4 thru 10 of test_name) as string
copy new_name to (item i of the pos_data)
end if
end repeat
set AppleScript's text item delimiters to ","
set file_content to pos_data as string
set write_path to ((new_file as string))
set the write_path to the write_path as text
set the open_target_file to open for access the file write_path with write permission
set eof of the open_target_file to 0
write file_content to the open_target_file starting at eof
close access the open_target_file
end tell
beep 1
end adding folder items to
on read_this_file(file_to_read)
try
set file_to_read to file_to_read as text
set the retrieved_info to read alias (file_to_read) -- using delimiter "," as list
return retrieved_info
on error
return 0
end try
end read_this_file
I assume you cannot display a dialog when using Folder Actions either.
Dont’ worry about the handler, I have been trying every avenue I know, which isn’t many I may add!
Steve