Know if Hazel has copied file/s

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Know if Hazel has copied file/s Fri Jan 06, 2012 7:15 am • by markhunte
I often copy files over a network using hazel. The files come in on an FTP, so I do not know when they will arrive or how many at any one time.
But if there is a problem in the copy action, Hazel will throw up a growl message which only sticks around for a few seconds.

If I am not around when this happens I miss the message or it disappears too soon for me to figure out what file/s could not be copied.
This means I may be missing files and not know, or if I do know, I have to do a compare on the files. Which is not easy because the copies are processed and moved through other systems into a image browsing system.

The simple solution is to use Hazel to Label the index colour of the file and then copy it. example Red. Then after the copy action, re label the index colour. Example Green.

But the second problem is if you use the Copy file Action in Hazel. It will then run all following actions on the copy.
Meaning the original file will always stay Red and the copy will be Yellow. But as I said above I the copy files may have been moved through another system by the time I notice this.

My solution to this was use comments, applescript and the Hazel Switch file property "hazelSwitchFile:" and theFile variable.

I now :
Label the file Red.
Use embedded apple script to get the file path and set it to the files comments.
Copy the file to the destination folder.
Use embedded apple script to:
Get the files comment which will be the path to the Original file (remember i the actions are now working on the copy)
The applescript then switches the file path with , example "hazelSwitchFile: pathFromComment".

Hazel will now process again the original file with any following actions.
So the last action is the re label the files index colour. Example Green.

If the actions did not get past the copy stage, then the file will be labeled 'Red' if i succeeded then it will be 'Green'
Un-labeled the rules did not run on the file.

Image

The Set comment Code:
Code: Select all
tell application "Finder" to set comment of theFile to ((POSIX path of theFile) as string)


The Get comment/ Switch File Code:
Code: Select all
tell application "Finder" to set origFile to comment of theFile
return {hazelSwitchFile:origFile}


My copy file stick around long enough for the comments to be read. But I do have script that will write the path out to a file instead. If anyone wants that just ask here.
markhunte
 
Posts: 5
Joined: Fri Jan 06, 2012 6:00 am

Re: Know if Hazel has copied file/s Fri Jan 06, 2012 7:14 pm • by a_freyer
markhunte wrote:...
But if there is a problem in the copy action, Hazel will throw up a growl message which only sticks around for a few seconds...



An interesting workaround, but Hazel does have the option for sticky growl alerts - ones that stay on the screen until clicked. Perhaps this is overkill?
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Know if Hazel has copied file/s Fri Jan 06, 2012 9:23 pm • by markhunte
Hi,

The only control in Hazel is for your Growl notification Actions not the errors.

But you got me thinking. I had looked in Hazel for the control. But I should have looked at growl its self. and sure enough there is controls there.

Saying that, the amount of files I have moving and could run into a problem if say part of the network was down would fill my screen.
And I would have to click on every error message to be taken to the file. (if I could see the screen. :D )
This gives me a quick visual on whats been processed or not.
markhunte
 
Posts: 5
Joined: Fri Jan 06, 2012 6:00 am

Re: Know if Hazel has copied file/s Mon Jan 09, 2012 12:02 pm • by Mr_Noodle
You can set the errors to be sticky. Go into Growl's preferences and select Hazel in the applications list. You can override behaviors for different classes of alerts there.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Tips & Tricks - DO NOT POST QUESTIONS