Delay Running a Rule

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Delay Running a Rule Sat Jul 08, 2017 5:23 pm • by Courtman
Hi all, first post and new user of Hazel - looks very interesting and has great potential.

I'm using Hazel to run a script to transfer images from Lightroom into Apple Photos. I export from Lightroom into a Temporary Folder, and Hazel then imports the contents of said temporary folder into Photos, then deletes the files. It's a one-click workaround to transfer the files, beautiful.

The problem I have is that as soon as the first file hits the temporary folder Hazel runs the script. While it picks up most of the files there are occasions (especially if I'm transferring 20+ files at once) where some files are missed, and I then have to re-run the Hazel script to check the folder and it goes "oh yeah!" and moves the last ones over.

What I really need is a way for Hazel to see activity in the Temp Folder, and then WAIT. Either until there is no more activity, or for a set time - I was thinking 60secs or so should be enough.

The rules I have at the moment are as follows:

If all of the following conditions are met

If Kind is Image

Do the following to the matched file or folder

Import into Photos to album All Photos
Move to folder Trash


Nice and simple, but being a code novice I can't really figure out a way to make it stop and wait before it runs it. If anyone can point me in that direction (make it simple, as I say I'm not that technically savvy any more!) I'd be most grateful!
Courtman
 
Posts: 4
Joined: Sat Jul 08, 2017 5:01 pm

Re: Delay Running a Rule Mon Jul 10, 2017 11:03 am • by Mr_Noodle
Try adding a condition like "Date added is after date last matched". There shouldn't be a need for a delay in this case.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Delay Running a Rule Sat Jul 15, 2017 5:56 pm • by Courtman
Thanks for that, just tried it with 16 files in one hit and seemed to work OK - I shall keep an eye on it!
Courtman
 
Posts: 4
Joined: Sat Jul 08, 2017 5:01 pm

Re: Delay Running a Rule Tue Jun 18, 2019 11:29 am • by Courtman
Courtman wrote:Thanks for that, just tried it with 16 files in one hit and seemed to work OK - I shall keep an eye on it!


Just a reply to kick this back out of the long grass, it still isn't working as I want it to and darned if I can find a solution.

I've just exported 15 files from Lightroom into a folder. It probably takes 30secs to export the 15 JPEGs, and about halfway thru the export process Hazel grabs the folder and starts importing into Photos. It does however only do a few (three in this case), then sits there and does nothing with the remaining 12 files.

I've got it set up as above - Kind = Image. Date added is after date last matched. Move to Photos. Move to Trash. But it doesn't get them all, then doesn't go back and sweep up afterwards.

Anybody with any advice please? I'd be most grateful as the wife is using this now, and rather than clicking Run Rule manually like I do she tends to get sweary and blames me!
Courtman
 
Posts: 4
Joined: Sat Jul 08, 2017 5:01 pm

Re: Delay Running a Rule Tue Jun 18, 2019 2:31 pm • by luomat
Try adding a rule at the top about "last modified is not in the past 1 minute" which should delay Hazel long enough that all of the files are in it before it runs.
luomat
 
Posts: 78
Joined: Wed Mar 10, 2010 3:57 pm

Re: Delay Running a Rule Wed Jun 19, 2019 1:29 pm • by Courtman
Thanks - will give it a go! BUT...?!

The options I have for "Date Last Modified" "is not" are...
-Date Created
-Date Last Modified/Opened/Created
-Today
-This Week/Month/Quarter/Year
-specific date

Not sure how I can just make it pause for a minute, take a breath and smell the roses, then launch!
Courtman
 
Posts: 4
Joined: Sat Jul 08, 2017 5:01 pm

Re: Delay Running a Rule Wed Jun 19, 2019 10:31 pm • by luomat
I checked the exact verbiage that I use in one of my rules, and what I was thinking is:

"Date Last Modified"

"Is not in the last"

"1"

"Minute"
luomat
 
Posts: 78
Joined: Wed Mar 10, 2010 3:57 pm

Re: Delay Running a Rule Tue May 11, 2021 11:13 pm • by pyrrh0
I found I needed to do this for a rule that I use that moves scanned PDFs out of my local Google Drive folder after Google Backup & Sync brings them over. GB&S appears to perform a 2nd pass before closing its session -- what this means is GB&S syncs a file over, Hazel moves it, GB&S syncs it again and now I have two local copies to deal with.

I tried the date-last-modified rule but didn't want to wait a minute. Instead I added a "Run AppleScript" with embedded script containing the single line of "delay 15". This gives GB&S plenty of time to finish its session and doesn't add extra delay to my workflow.
pyrrh0
 
Posts: 2
Joined: Thu Jan 17, 2019 7:56 pm


Return to Support