I have some problems with AppleScript and Hazel.
I'm quite new to AppleScript, so I don't know, how to handle "theFile" correctly.
- Code: Select all
beep
set fileNameOne to theFile
display dialog "The File " & fileNameOne & " is old. Move to trash?" buttons {"Yes", "No"} default button 1
set the button_pressed to the button returned of the result
if the button_pressed is "Yes" then
tell application "Finder"
move file theFile to the trash
end tell
else
set myPath to theFile
tell application "Finder"
set label index of (myPath as alias) to 2
end tell
end if
If I try this in Skripteditior (with an explizit file instead of "theFile", it works correctly. But not in Hazel.
And sometimes, if I want to aktivate a rule with an embedded script (with a failure in the script), Hazel crashes :/
Any ideas, how to correct the code?
Thanks in advance!
Bye