Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'An AppleScript to mount, run, unmount a disk image' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to mount, run, unmount a disk image
Authored by: rattler14 on Sep 10, '04 07:24:12PM

A more flexible perl solution, in case you have multiple mounts, in multiple locations. Also remote friendly



### Add your disk image name, and location here

if($command eq "mount")
{ system "hdiutil mount $directories{$name}"; }
elsif($command eq "unmount")
$mount_data = `mount`;
system "hdiutil detach $dev";
{ print "sorry, must select mount or unmount";}

Save as, make it executible by running chmod a+x, then dump it into /usr/local/bin
Works great for me, and is a bit more compact and easier for a command line guy like me to understand.

Any thoughts suggestions, let me know



[ Reply to This | # ]
An AppleScript to mount, run, unmount a disk image
Authored by: toor on Oct 06, '04 09:08:11PM

Re: rattler14's script -

Handy, thanks. However, a few comments/questions:
1) When I tried to put the file in /usr/local/bin/ is gave me a permissions error and I had to login as root to place it. Is that normal?

2) Being a bit of a *nix newbie is there any other command to run it than:
/usr/local/bin/ ? Maybe my path needs updating?

3) I would like to use this ( or something like it ) to unmount one of my main drive's three partitions. Is that possible? Currently when I run it, it unmounts both of the non-running partitions.

Thanks for your time and help in these matters.

[ Reply to This | # ]