Page 1 of 1

Automator error, but workflow seems to work

PostPosted: Wed Aug 22, 2012 5:29 pm
by ddougan
I'm very new to Hazel and have created a rule to unzip archives and then delete the zip file. I initially tried with the Unarchive option, followed by Move to Trash; however, the archive and the unzipped result (1 file in the example case) both ended up in the trash.

I therefore created an Automator workflow:

Get folder contents -> Filter Finder items (extension contains zip) -> Open Finder items (default application) -> Get Folder contents -> Filter Finder items (extension contains zip) -> Move Finder items to Trash.

Hazel's rule is Extension ends with zip -> Run Automator workflow.

I get the archive contents in the Downloads folder and the archive ends up in Trash, but I see an error displayed:

hazelworker[1416] Error executing Automator workflow /Users/des/Library/Workflows/Applications/Finder/Unzip Files.workflow: Error Domain=com.apple.Automator Code=0 "The operation couldn’t be completed. (com.apple.Automator error 0.)"

hazelworker[1416] [Error] Automator workflow failed: Error executing automator workflow /Users/des/Library/Workflows/Applications/Finder/Unzip Files.workflow on file /Users/des/Downloads/Growl Message Select Icon.scpt.zip.

I'd appreciate ideas why the error is displaying. I've run the workflow directly from Automator (I just added the file selection rule to test) and it runs cleanly.


Thanks,

Des

Re: Automator error, but workflow seems to work

PostPosted: Thu Aug 23, 2012 12:40 pm
by a_freyer
Using the 'unarchive' rule in Hazel automatically sends the zip to the trash. So, when you wrote your original rule, you likely did this:


Code: Select all
If (all) of the following conditions are met for (the file or folder being matched)
     Kind is archive

Do the following to the matched file or folder:
     Unarchive
     Move file to Trash


Right?


Well, the "Move to Trash" action is now handling the unzipped files or folder. That's why it went directly to the trash. What you need is to remove the "move to trash" line like this:


Code: Select all
If (all) of the following conditions are met for (the file or folder being matched)
     Kind is archive

Do the following to the matched file or folder:
     Unarchive



And your rule will execute as you expect.

Re: Automator error, but workflow seems to work

PostPosted: Thu Aug 23, 2012 3:27 pm
by ddougan
Well, that was an easy solution! Very many thanks - not knowing the Unarchive process did that was the real issue.

David Sparks (macsparky.com) speaks very highly of Hazel and it's clear why.

Des