Bug - File Vault & Folder Action Scripts - Cannot resolve added_items aliases?
Bug - File Vault & Folder Action Scripts - Cannot resolve added_items aliases?
- Subject: Bug - File Vault & Folder Action Scripts - Cannot resolve added_items aliases?
- From: Diggory Laycock <email@hidden>
- Date: Fri, 19 Dec 2003 14:38:54 +0000
Hi,
I have written a Folder Action script that alters files added to the
folder.
It works fine on my machine - but on a friend's it fails (He has
FileVault enabled.)
Below is the script - the offending line is "if name of aFile contains
{".aspx"} then" - which returns an error if the folder to which the
script is attached is FileVault encrypted.
The error returned is: "can't make name of item 1 of {alias
"willbank:Downloads:Control.3.aspx"} into string"
Is it an error by me in the way I have referenced the file - or is this
a bug I should report?
on open theFiles
changeToPDF(theFiles)
end open
on adding folder items to this_folder after receiving added_items
changeToPDF(added_items)
end adding folder items to
to changeToPDF(added_items)
tell application "Finder"
repeat with aFile in added_items
if name of aFile contains {".aspx"} then
set theDate to (current date)
-- Make the time suitable for a file name (replace ":" with ".")
set timeText to time string of theDate
set ReplaceString to "."
set OldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set newTimeText to text items of timeText
set AppleScript's text item delimiters to ReplaceString
set finalText to newTimeText as text
set AppleScript's text item delimiters to OldDelims
-- log (finalText)
set dateString to ((day of theDate) & " " & (month of theDate) & "
" & finalText) as string
set newName to dateString & ".pdf"
display dialog ("renaming: " & name of aFile & " to: " & newName)
buttons {"OK"} giving up after 2
-- rename the incoming file
tell application "Finder"
try
set the name of file aFile to newName
on error errMsg number errNum
-- Deal with any error in getting path--first log to console:
log "Error loading script. " & "Error: " & errNum & " Msg: " &
errMsg
-- For user-related error, can display a dialog:
display dialog "Error: " & errNum & ". " & errMsg
end try
open aFile
end tell
end if
end repeat
end tell
end changeToPDF
Diggory Laycock
-----------------------
http://www.monkeyfood.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.