Page 1 of 1

applescript to delay a rule being invoked

PostPosted: Tue Nov 06, 2012 8:57 pm
by cmalberto
Maybe this is the wrong approach and perhaps someone will school me on what really todo. Having said that here is what I want to do.

My ScanSnap scanner scans to a PDF folder which my Hazel monitors. Since each PDF is searchable, I have a list of rules detecting key words to rename the file to what the title of the rule is(ok I fake it), and then imports to Evernote via another AppleScript.

This works fine until I scan a document that doesn't have a rule. So I have this MISC rule to catch everything else. The problem is timing. Sometimes my MISC rule gets invoke prematurely...even though I have it at the bottom of the list.

So I was thinking if I can put an additional check in the rule to check if the file is more than a minute or two old then this rule would be guaranteed to run last - or so I think anyway.

Is there a way to add an applescript check to see if the file name is older than a minute or two and if so how to code it?

Of course, if there is a better approach to this, I would like to hear that too.

Thanks in advance....

--Mickey

Re: applescript to delay a rule being invoked

PostPosted: Wed Nov 07, 2012 11:28 am
by a_freyer
Applescript is not necessary for this - Hazel has the functionality built in. In your misc rule, check either the file created date or the modified date as a condition.

Re: applescript to delay a rule being invoked

PostPosted: Wed Nov 07, 2012 10:48 pm
by cmalberto
I have seen these but the file added is DATE driven and not TIME driven. Maybe I just don't see it.

I did see a CURRENT TIME which could be set to let's say after 11PM(as an example) but I was really looking for minutes after the file was created.

If you can elaborate that would be helpful. Thanks again.

--Mickey

Re: applescript to delay a rule being invoked

PostPosted: Wed Nov 07, 2012 11:06 pm
by a_freyer
You'll notice if you use this rule that you can select minutes, seconds, hours, days, etc. A date includes the time.