But at least i have a question about the handling of applescripts. I use Hazel for the following workflow for my SCAN folder.
1. Check if KIND is PDF
2. Check if SIZE is greater than 0 (zero)
3. Check if CONTENT contains INVOICE
4. Check if CONTENT contains AMAZON
if all of the above is true then
5. RENAME filename to '2012-02-27 07:56 (Invoice Amazon).pdf'
6. SET OPENMETA TAG to INVOICE, AMAZON and clear all other tags
7. RUN APPLESCRIPT in ~/Library/Scripts/Applications/Hazel/DEVONimport.scpt
The problem is following. When i try the above workflow, Hazel tells me, that the applescript failed.
But when i embedde the script into hazel it works like charm.
It seems to be no problem but i have nearly 50 workflows like that and counting. When i extend the
script i have to change it 50 times.
So can anyone please explain me why the following script only works when i embedde it.
- Code: Select all
tell application id "com.devon-technologies.thinkpro2" to launch
tell application "Finder"
set file_list to name of every file of folder (alias "Macintosh HD:Users:Thomas:Scan:")
repeat with entry in file_list
set Jahr to text 1 thru 5 of entry
set AktuellesJahr to year of (current date)
set YYYY to AktuellesJahr as string
if Jahr is YYYY & "-" then
tell application id "com.devon-technologies.thinkpro2"
import "Macintosh HD:Users:Thomas:Scan:" & entry to incoming group
if exists "Macintosh HD:Users:Thomas:Scan:" & entry then
tell application "Finder" to delete "Macintosh HD:Users:Thomas:Scan:" & entry
end if
end tell
end if
end repeat
end tell
Thank you in advance and sorry for my english.
Thomas