advertisement
Forums

The Forum is sponsored by 
 

AAPL stock: Click Here

You are currently viewing the Tips and Deals forum
any AppleScript hotshots? trying to get a disk identifier
Posted by: mattkime
Date: March 25, 2010 02:57PM
i'm attempting to improve on an applescript to install chdk. i'm able to create a list of disks but i need to get their disk identifier (i.e. disk0s1)

this is the code so far -

set allDrives to the name of every disk whose ejectable is true and local volume is true and startup is false
set selectedDrive to {choose from list allDrives with prompt "Choose the drive to unmount:"} as text

advice? know of any good applescript forums?



Options:  Reply • Quote
Re: any AppleScript hotshots? trying to get a disk identifier
Posted by: TheCaber
Date: March 25, 2010 04:43PM
Tell Terminal.app to execute the command 'mount'.
You will get a listing of all mounted devices and their mount points in the filesystem. For example,
% mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local)
fdesc on /dev (fdesc, union)
map -hosts on /net (autofs, automounted)
map auto_home on /home (autofs, automounted)
/dev/disk1s2 on /Volumes/Wayback (hfs, local, nodev, nosuid, journaled)
/dev/disk3s2 on /Volumes/Dofus (hfs, local, nodev, nosuid, read-only, noowners, quarantine, mounted by auser)
/dev/disk4s2 on /Volumes/Adobe AIR (hfs, local, nodev, nosuid, read-only, noowners)
/dev/disk2s1 on /Volumes/USER IPOD (msdos, local, nodev, nosuid, noowners)



=TC



Edited 1 time(s). Last edit at 03/25/2010 04:46PM by TheCaber.
Options:  Reply • Quote
Re: any AppleScript hotshots? trying to get a disk identifier
Posted by: Finney
Date: March 25, 2010 05:30PM
Here is one way to do it:

tell application "Finder" to set allDrives to the name of every disk whose local volume is true and startup is false
set driveName to {choose from list allDrives with prompt "Choose the drive to unmount:"} as text

set getDriveIdentifier to "diskutil info " & quoted form of driveName & " | grep Ident | awk '{print $3}'"
set driveIdentifier to do shell script getDriveIdentifier

-Finney
Options:  Reply • Quote
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 307
Record Number of Users: 186 on February 20, 2020
Record Number of Guests: 2330 on October 25, 2018