Help: mount dmg then hide finder window

System: OS 10.3.5
Purpose: Mount three different .dmg’s to the desktop from where they are sitting on the HD then close the 3 finder windows that pop up as a result of the .dmgs mounting.

Okay, i can write a script to mount the dmg, and i can write a script to close every folder, BUT, i can’t get them to work together properly. The dmgs each take 3 or 4 seconds to mount, and the script keeps on plodding along and closes the finder windows before the dmgs are finished mounting, so they go ahead and open finder windows anyway.

I guess i need some sort of delay between the mounting and the window closing…

Any help would be greatly appriciated.

Singluar sample:

tell application “finder”
open “HD:vistas.dmg”
end tell

tell application “finder”
close every window
end tell

delay number (Standard Additions)

Here’s an example from a script I made:

tell application "Finder" to open "HD:path:myimage.dmg"
delay 3
launch application "My application that looks for a disk image"


I have a question. Say I created my own disk image file. How do you get the disk image to auto open in osx?


I guess we’re a bit OT, btw… You should remember to make the “last-saving” while its window is still open, I believe.

Thanks for the Delay comment, works great!

Hi alfabreeze,

I opened the disk image window, then put a file in it, and ejected the image while the window was still open. When I mounted the disk image again, the window did not auto open. This is not really off topic because this is the behavior Onlyonejeep wants.

Thanks for the suggestion,

Hi kel!
For truth sake, that’s supposed to be the behavior Onlyonejeep is seeking for a script to avoid it! :slight_smile:
Btw; you’ve almost made it.
Keep in mind the first disk image you created from DiskUtility will act like a sort of “template”.
So… you “open the disk image window and ejected the image while the window was still open”. That’s right.
Mounting back the same disk image, instead, is wrong and won’t work.
Once you’ve ejected the first disk image (leaving its window open), you’ll have to return back to DiskUtility, select the disk image file and, from the upper Menu “Images” (I’m translating from Italian OS; look for something the closest U can find) select “Convert…”.
HERE you’ll create the real and final Disk Image. Choose “Format”->“Compressed” and, if U want, protect it with a L/P. Give it the final real name and save it.

That’s it; auto open and read-only :wink:

Hi alfabreeze,

It worked. I used Disk Copy to convert the image file because I’m running Jaguar. Learned something new today.

Thanks a lot,