Ejecting DMGs

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

Fri Oct 26, 2007 1:18 am • by NightOne
Mr_Noodle wrote:I think there is some confusion here about the difference between the disk image and it's mounted folder.


I believe I understand this. Agreed, all my dmgs are in a folder called DMGs. (Hazel moves them there!)

I think the difference is that the attributes of the mounted dmgs in the Volumes folder appear to be missing some of the things that the standard files have. (like the Date Last Opened)

Oddly though, my external fireware HD partitions in the Volumes folder do show a Date Last opened.

Mr_Noodle wrote:Volumes does not contain disk images (the dmg files). When you mount the dmg files, the folder is mounted under Volumes. Note that this is not the dmg file itself so checking any dates on the dmg file won't help since they are not located in the Volumes folder (and aren't the files you care about anyways).


Correct. My rule doesn't look for the dmg files themselves. Right? :)

Mr_Noodle wrote:To do what I think you are trying to do, use "Date Added" on the mounted volume. The mount points appear when the disk image is mounted so it should reflect what you want (the date when it was mounted) since from the view of the Volumes folder, those folders were just added. I believe the Eject Automator action also operates on the volume, not the disk image file, so it should work.


At least with the Get Info screens I do, I am not seeing a Date Added.

Mr_Noodle wrote:So, in short, just change "Date Last Opened" to be "Date Added". Let me know if that works out.


Unfortunately, No. However, I am going to keep trying. (time permitting)
NightOne
 
Posts: 8
Joined: Sat Aug 25, 2007 4:13 pm
Location: Tennessee

Fri Oct 26, 2007 3:39 pm • by Mr_Noodle
Date added is recorded by Hazel, not by OS X so it won't show up in "Get Info" or anything like that. I think it should work so try it out and let me know.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Tue Nov 27, 2007 9:27 pm • by NightOne
Mr_Noodle wrote:Date added is recorded by Hazel, not by OS X so it won't show up in "Get Info" or anything like that. I think it should work so try it out and let me know.


Wasn't able to get it to work that way either. Been too busy to play with it much lately though. :)
NightOne
 
Posts: 8
Joined: Sat Aug 25, 2007 4:13 pm
Location: Tennessee

Re: Ejecting DMGs Mon Sep 21, 2015 7:44 am • by okaypol
This works:



Hazel on "Desktop folder"

Image


Copy and paste this script:


Code: Select all
try
   tell application "Finder"
      eject the disks
   end tell
on error
   display dialog "Unable to eject all disks." buttons {"Close"} default button "Close"
end try



This will eject every volume if it has not been created today.

Stay awesome~ :mrgreen:
okaypol
 
Posts: 10
Joined: Mon Sep 21, 2015 7:23 am

Re: Ejecting DMGs Thu May 05, 2016 9:53 am • by preview
Hi! There is my version,
'MyVolumeName' - the static name of dmg

Image
preview
 
Posts: 1
Joined: Tue Jan 19, 2016 12:00 pm

Re: Ejecting DMGs Sun May 08, 2016 1:35 pm • by Loyd
Hello,

How to eject a dmg when a specific application quit ?
Can it be done using a script ?
Thank you
Loyd
 
Posts: 9
Joined: Fri Nov 15, 2013 5:42 pm

Re: Ejecting DMGs Mon May 09, 2016 10:45 am • by Mr_Noodle
Hazel doesn't really watch for that type of thing. You'll have to look into some other software that can detect an app quitting to trigger it.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Ejecting DMGs Mon May 09, 2016 10:48 am • by Loyd
Mr_Noodle wrote:Hazel doesn't really watch for that type of thing. You'll have to look into some other software that can detect an app quitting to trigger it.

Thank you
Loyd
 
Posts: 9
Joined: Fri Nov 15, 2013 5:42 pm

Re: Ejecting DMGs Thu May 26, 2016 4:02 pm • by skeskali
okaypol wrote:This works:


This will eject every volume if it has not been created today.

Stay awesome~ :mrgreen:



I've tried everything, but I can't get this to work. The Hazel DMG still shows on my desktop no matter what I do. What am I doing wrong?
skeskali
 
Posts: 2
Joined: Wed May 25, 2016 11:57 am

Re: Ejecting DMGs Tue Jul 12, 2016 5:53 am • by superbimble
I humbly submit another version of preview's zsh script. (the rule I use is the same, I just changed the shellscript)

My reasoning is that I have a TimeMachine volume I leave attached all the time, and don't want that to be ejected, but I didn't want to pass the volume name individually each time.

In the script below, my TimeMachine volume is called TIME, if you have your own TimeMachine volume, you should change the word TIME to whatever your volume is called.

Code: Select all
for i in `mount | grep /Volumes | grep -v TIME | awk '{print $1}'`
do
diskutil unmount $i
done


Hope that might be of some use to someone.
superbimble
 
Posts: 1
Joined: Tue Jul 12, 2016 5:41 am

Previous

Return to Tips & Tricks - DO NOT POST QUESTIONS