Volumes (Disk Images) run with rules

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

Moderator: Mr_Noodle

Volumes (Disk Images) run with rules Sat Apr 21, 2012 11:11 am • by flynn
Ok so I was wondering if the action "run rule on folder content" works with volumes / disk images.

Basically, I have rules for my download folder that unzip a zipped file, moves a dmg file to the /app folder then mounts it, moves an app to the /app folder.
My 'problem' though, is that mounting a disk image is not very useful if rules inside that can't be run automatically. I was wondering if once a disk is mounted, I could have hazel "go into" the volume the same way it can go into a folder, and run rules from there, so that my whole automation process is accelerated since I don't have to worry about moving or launching anything from a newly added disk image, hazel will do the same as it does in my downloads folder.

Thanks ! :D

Edit: Although I think I may have found how to do this, I'm not sure how to differentiate an external hard drive from a disk image.
flynn
 
Posts: 66
Joined: Sun Apr 08, 2012 12:41 pm
Location: Philippines

Re: Volumes (Disk Images) run with rules Sun Apr 22, 2012 12:51 am • by a_freyer
If your workflow can handle a re-name of each DMG the same name, then you should have no trouble adding that name from /Volumes/MyDMGName
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Volumes (Disk Images) run with rules Sun Apr 22, 2012 1:04 am • by flynn
I'm not sure how that is going to help, as the name of the dmg file does not affect the name of the volume.
flynn
 
Posts: 66
Joined: Sun Apr 08, 2012 12:41 pm
Location: Philippines

Re: Volumes (Disk Images) run with rules Sun Apr 22, 2012 4:36 pm • by a_freyer
Oh, obviously. Wasn't thinking when I posted that. haha

Well, another option would be to monitor the volumes folder for file sizes. This works for me:

Code: Select all
Name: IGNORE THE MAIN DRIVES
if (all) of the following conditions are met for (current file or folder)
     size is 1 byte

then
     ignore file

Name: DIVE INTO SUBFOLDERS
if (all) of the following conditions are met for (current file or folder)
     kind is folder

then
     run rules on folder contents

Name: COPY TO APPLICATIONS
if (all) of the following conditions are met for (current file or folder)
     kind is Application

then
     copy to /Applications
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Re: Volumes (Disk Images) run with rules Sun Apr 22, 2012 6:28 pm • by flynn
I tried filtering the drives with number of subfiles/folder and the size of the volume, that works for non empty hard drives, which should be enough for now.

I used dropbox installer as a test volume, and it passes the conditions to run the volume rules. I check inside, the dropbox app passes the condition to be moved to an app folder. But nothing happens, and hazel eventually returns an error. I took the logs from when it started to run the rules up until it ended. After the error, I tried ejecting the volume but it says that system preferences is still using it. I have to stop hazel to be able to eject the volume, unless no conditions match it


Image


Code: Select all
2012-04-23 06:24:30.859 hazelworker[8627] DEBUG: Processing directories: (
    "/Volumes"
)
2012-04-23 06:24:30.860 hazelworker[8627] DEBUG: About to process directory /Volumes
2012-04-23 06:24:30.862 hazelworker[8627] DEBUG: .DS_Store: File is hidden/invisible. Skipping.
2012-04-23 06:24:30.865 hazelworker[8627] [Error] Error during rule evaluation: Received error while trying to evaluate rule Volumes on file Dropbox Installer
2012-04-23 06:24:30.866 hazelworker[8627] Error while matching rule Volumes against file /Volumes/Dropbox Installer: Could not retrieve metadata for file: /Volumes/Dropbox Installer
2012-04-23 06:24:30.866 hazelworker[8627] DEBUG: Tapping error retry sequence
2012-04-23 06:24:30.866 hazelworker[8627] (
   0   CoreFoundation                      0x00007fff960a8fc6 __exceptionPreprocess + 198
   1   libobjc.A.dylib                     0x00007fff97617d5e objc_exception_throw + 43
   2   hazelworker                         0x0000000100019bc8 start + 99824
   3   hazelworker                         0x000000010001a26f start + 101527
   4   hazelworker                         0x00000001000190d7 start + 97023
   5   Foundation                          0x00007fff96f0df5d -[NSCustomPredicateOperator performPrimitiveOperationUsingObject:andObject:] + 46
   6   Foundation                          0x00007fff96ed5725 -[NSPredicateOperator performOperationUsingObject:andObject:] + 109
   7   Foundation                          0x00007fff96ed500c -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 290
   8   Foundation                          0x00007fff96ed4abe -[NSPredicate evaluateWithObject:] + 18
   9   hazelworker                         0x0000000100036f41 start + 219497
   10  hazelworker                         0x0000000100036c46 start + 218734
   11  hazelworker                         0x000000010003bf04 start + 239916
   12  hazelworker                         0x00000001000363dd start + 216581
   13  hazelworker                         0x00000001000027a0 start + 4552
   14  hazelworker                         0x00000001000036d3 start + 8443
   15  hazelworker                         0x0000000100006562 start + 20362
   16  hazelworker                         0x000000010000160c start + 52
)
2012-04-23 06:24:30.866 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes/Dropbox Installer and rule Volumes: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.866 hazelworker[8627] DEBUG: [PREDICTION] Calculating fire time - predicate: displayExtension ==[cd] "pkg" negation: 0 result: 0
2012-04-23 06:24:30.866 hazelworker[8627] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-23 06:24:30.866 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes/Dropbox Installer and rule Pkg Files: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.866 hazelworker[8627] DEBUG: [PREDICTION] Calculating fire time - predicate: displayExtension ==[cd] "app" negation: 0 result: 0
2012-04-23 06:24:30.866 hazelworker[8627] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-23 06:24:30.866 hazelworker[8627] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-23 06:24:30.866 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes/Dropbox Installer and rule Apps: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.867 hazelworker[8627] DEBUG: [PREDICTION] Calculating fire time - predicate: displayExtension ==[cd] "zip" negation: 0 result: 0
2012-04-23 06:24:30.867 hazelworker[8627] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-23 06:24:30.867 hazelworker[8627] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-23 06:24:30.867 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes/Dropbox Installer and rule Zip Files: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.867 hazelworker[8627] DEBUG: [PREDICTION] Calculating fire time - predicate: displayExtension ==[cd] "dmg" negation: 0 result: 0
2012-04-23 06:24:30.867 hazelworker[8627] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-23 06:24:30.867 hazelworker[8627] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-23 06:24:30.868 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes/Dropbox Installer and rule Dmg files: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.868 hazelworker[8627] DEBUG: Dropbox Installer: Did not match any rules.
2012-04-23 06:24:30.896 hazelworker[8627] DEBUG: [PREDICTION] Calculating fire time - predicate: typeObject isType: "hazelkind:Volume" negation: 0 result: 0
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes and rule Volumes: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Calculating fire time - predicate: displayExtension ==[cd] "pkg" negation: 0 result: 0
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes and rule Pkg Files: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Calculating fire time - predicate: displayExtension ==[cd] "app" negation: 0 result: 0
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes and rule Apps: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.897 hazelworker[8627] DEBUG: [PREDICTION] Calculating fire time - predicate: displayExtension ==[cd] "zip" negation: 0 result: 0
2012-04-23 06:24:30.898 hazelworker[8627] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-23 06:24:30.898 hazelworker[8627] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-23 06:24:30.898 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes and rule Zip Files: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.898 hazelworker[8627] DEBUG: [PREDICTION] Calculating fire time - predicate: displayExtension ==[cd] "dmg" negation: 0 result: 0
2012-04-23 06:24:30.898 hazelworker[8627] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-23 06:24:30.898 hazelworker[8627] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-23 06:24:30.899 hazelworker[8627] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes and rule Dmg files: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-23 06:24:30.899 hazelworker[8627] DEBUG: Volumes: Did not match any rules.
2012-04-23 06:24:30.899 hazelworker[8627] DEBUG: Writing out DB file: /Volumes
2012-04-23 06:24:30.970 hazelworker[8627] DEBUG: Directory /Volumes processed.
2012-04-23 06:24:30.971 hazelworker[8627] Sending metrics to scheduler. Next scheduled run: 2012-04-23 06:29:30.865
2012-04-23 06:24:30.972 hazelworker[8627] DEBUG: Done
 
flynn
 
Posts: 66
Joined: Sun Apr 08, 2012 12:41 pm
Location: Philippines

Re: Volumes (Disk Images) run with rules Mon Apr 23, 2012 12:27 pm • by Mr_Noodle
There seems to be an error in getting metadata from /Volumes/Dropbox Installer. You may want to restructure the rule so it doesn't request any Spotlight metadata from the folder.

Also, I'd like to point out that it's a bit dangerous to use the subfolders rule when monitoring Volumes (or even calculating size). Every file in your system is potentially underneath /Volumes so it can be extremely resource intensive. Use with care.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Volumes (Disk Images) run with rules Mon Apr 23, 2012 6:31 pm • by flynn
I tried mounting other volumes, none of them gave me a metadata error.

Image
is the rule I use to check if it is an image file. I then check for either .app, .pkg or .zip extensions inside. Even though hazel seems to find the correct items, it doesn't act upon it and just leaves them as is.

Also, a friend plugged in his hard drive yesterday and after a while, I noticed all his movies got transferred to my computer. How is that possible? I don't check for movies other than in my downloads folder, and I make hazel send a notification every time it performs an action, which it didn't do.
flynn
 
Posts: 66
Joined: Sun Apr 08, 2012 12:41 pm
Location: Philippines

Re: Volumes (Disk Images) run with rules Tue Apr 24, 2012 3:23 pm • by Mr_Noodle
Can't say about the movie files without seeing all your rules. Maybe you have some other software that does that.

As for your current rule, it's not clear to me what you are trying to do. The best I can do is interpret what you have which is this:

If the current item is a volume, not named Macintosh HD, not red, and not 1 byte (note that it can be higher or lower than 1 byte) and either has fewer than 6 items in it or is less than 3G,

then

Go into that folder and run rules on it and then color that folder red.

That seems a bit weird to me but if it what fits what you need, then so be it.

Again, without seeing your other rules, I can't say why it's not working. For cases like this, it's probably best to email support and send in your full ruleset as it takes forever trying to get things piecemeal via the forums.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Volumes (Disk Images) run with rules Thu Apr 26, 2012 5:21 am • by flynn
Here are all my rules

Image

Image
Image

Image
Image
Image
Image
Image
flynn
 
Posts: 66
Joined: Sun Apr 08, 2012 12:41 pm
Location: Philippines

Re: Volumes (Disk Images) run with rules Thu Apr 26, 2012 11:30 am • by Mr_Noodle
A couple things here:

Your zip files rule is set to "all" which can't happen if you are matching against different extensions. That should probably be "any".

Also, in your Volumes rule, are you using the built-in "Kind" attribute or the Spotlight version? In the pop-up, is it in the top section or bottom section? If it's in the bottom section, try using the built-in Kind attribute instead.

Lastly, calculating the size of a whole volume can be costly. Something to keep in mind.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Volumes (Disk Images) run with rules Thu Apr 26, 2012 6:46 pm • by flynn
There is no hazel volume kind, I had to go into others and search for volume, so i'm guessing that it is not a built it kind ( I tried the disk image kind, the rule is not match. I tried the folder kind, the rule is matched but again hazel doesn't act upon it and I don't want hazel to start moving things in my apps folder when they are in the volumes)

Image

But the thing is that the rules match, hazel just doesn't do anything after matching the volume rule. (I don't have the metadata error anymore)

Image
flynn
 
Posts: 66
Joined: Sun Apr 08, 2012 12:41 pm
Location: Philippines

Re: Volumes (Disk Images) run with rules Fri Apr 27, 2012 4:15 pm • by Mr_Noodle
Provide some logs, in particular, of anything about the Dropbox app. See if it matches the Apps rule there. Keep in mind that if it matched once and ran the actions already, it won't run the actions again.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Volumes (Disk Images) run with rules Sat Apr 28, 2012 1:34 am • by flynn
it matches the rule, but the app is never moved to the application folder

Code: Select all
2012-04-28 13:29:54.614 hazelworker[4814] DEBUG: About to process directory /Volumes
2012-04-28 13:29:54.620 hazelworker[4814] DEBUG: .DS_Store: File is hidden/invisible. Skipping.
2012-04-28 13:29:54.622 hazelworker[4814] DEBUG: [PREDICTION] Calculating fire time - predicate: displayBasename ==[cd] "Macintosh HD" negation: 0 result: 0
2012-04-28 13:29:54.622 hazelworker[4814] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-28 13:29:54.622 hazelworker[4814] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-28 13:29:54.623 hazelworker[4814] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes/Dropbox Installer and rule Ignore Main: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-28 13:29:54.623 hazelworker[4814] DEBUG: [PREDICTION] Calculating fire time - predicate: sizeObject ==[cd] 1 B negation: 0 result: 0
2012-04-28 13:29:54.623 hazelworker[4814] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-28 13:29:54.623 hazelworker[4814] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-28 13:29:54.623 hazelworker[4814] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes/Dropbox Installer and rule Ignore Alias: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-28 13:29:54.645 hazelworker[4814] DEBUG: [PREDICTION] Calculating fire time - predicate: typeObject isType: "hazelkind:Volume" negation: 0 result: 1
2012-04-28 13:29:54.645 hazelworker[4814] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-28 13:29:54.645 hazelworker[4814] DEBUG: [PREDICTION] Calculating fire time - predicate: labelColor !=[cd] 1 negation: 0 result: 1
2012-04-28 13:29:54.645 hazelworker[4814] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-28 13:29:54.646 hazelworker[4814] DEBUG: [PREDICTION] Calculating fire time - predicate: subitemCount <[cd] 6 negation: 0 result: 1
2012-04-28 13:29:54.646 hazelworker[4814] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-28 13:29:54.655 hazelworker[4814] DEBUG: [PREDICTION] Calculating fire time - predicate: sizeObject <[cd] 5 GB negation: 0 result: 1
2012-04-28 13:29:54.655 hazelworker[4814] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-28 13:29:54.656 hazelworker[4814] Dropbox Installer: Rule Volumes matched.
2012-04-28 13:29:54.656 hazelworker[4814] DEBUG: New rule signature. Executing actions.
Old signature: (null)
New Signature:{typeObject isType: "hazelkind:Volume" AND labelColor !=[cd] 1 AND subitemCount <[cd] 6 AND sizeObject <[cd] 5 GB}:{(recurse:,{
})(notify:(
    "{file}",
    " Passes Volumes Restrictions"
),{
    "Make Sticky" = 0;
})(color:1,{
})}
2012-04-28 13:29:54.658 hazelworker[4814] Hazel Alert: Dropbox Installer Passes Volumes Restrictions
2012-04-28 13:29:54.658 hazelworker[4814] [Custom Message] Hazel Alert: Dropbox Installer Passes Volumes Restrictions
2012-04-28 13:29:54.659 hazelworker[4814] Could not set catalog info for path /Volumes/Dropbox Installer: -61 - write permissions error
2012-04-28 13:29:54.659 hazelworker[4814] DEBUG: Caught error but not refiring.
2012-04-28 13:29:54.659 hazelworker[4814] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes/Dropbox Installer and rule Volumes: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-28 13:29:54.660 hazelworker[4814] DEBUG: [PREDICTION] Calculating fire time - predicate: displayBasename ==[cd] "Macintosh HD" negation: 0 result: 0
2012-04-28 13:29:54.660 hazelworker[4814] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-28 13:29:54.660 hazelworker[4814] DEBUG: [PREDICTION] Bail out: AND predicate
2012-04-28 13:29:54.660 hazelworker[4814] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes and rule Ignore Main: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-28 13:29:54.660 hazelworker[4814] DEBUG: [PREDICTION] Calculating fire time - predicate: sizeObject ==[cd] 1 B negation: 0 result: 1
2012-04-28 13:29:54.660 hazelworker[4814] DEBUG: [PREDICTION] Next fire time: 5828963-12-20 08:00:00.000
2012-04-28 13:29:54.660 hazelworker[4814] Volumes: Rule Ignore Alias matched.
2012-04-28 13:29:54.660 hazelworker[4814] DEBUG: New rule signature. Executing actions.
Old signature: (null)
New Signature:{sizeObject ==[cd] 1 B}:{(ignore:,{
})}
2012-04-28 13:29:54.660 hazelworker[4814] DEBUG: [PREDICTION] Predicted fire time for file: /Volumes and rule Ignore Alias: 5828963-12-20 08:00:00.000 Should poll: 0
2012-04-28 13:29:54.660 hazelworker[4814] DEBUG: Writing out DB file: /Volumes
2012-04-28 13:29:54.835 hazelworker[4814] DEBUG: Directory /Volumes processed.
2012-04-28 13:29:54.837 hazelworker[4814] Sending metrics to scheduler. Next scheduled run: 5828963-12-20 08:00:00.000
2012-04-28 13:29:54.838 hazelworker[4814] DEBUG: Done
2012-04-28 13:30:01.528 (null)[0] DEBUG: Could not scan past browser.download.dir preference
2012-04-28 13:30:01.544 hazelworker[4822] DEBUG: Chrome preference file not found.
2012-04-28 13:30:01.546 hazelworker[4822] DEBUG: Initialized
2012-04-28 13:30:01.546 hazelworker[4822] DEBUG: Pausing to wait for things to settle down.


after reading the logs a couple of times, I realized that the problem is coming from the fact that hazel doesn't dive into the volumes to run rules.
flynn
 
Posts: 66
Joined: Sun Apr 08, 2012 12:41 pm
Location: Philippines

Re: Volumes (Disk Images) run with rules Mon Apr 30, 2012 10:02 am • by Mr_Noodle
The issue is that the Volumes rule is failing because you are trying to set the color label but you don't have write permissions to do so. You might want to look into removing that action.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Volumes (Disk Images) run with rules Wed May 02, 2012 7:04 pm • by flynn
this seems to be working for almost every case. Thanks!
flynn
 
Posts: 66
Joined: Sun Apr 08, 2012 12:41 pm
Location: Philippines


Return to Support