why won't applescript record?

iMac Snow Leopard


I open applescript, hit record - open disk utility - mount a drive - tell applecript to stop


Nothing shows in the applescript window. What am I doing wrong?


Thanks

Posted on Jan 17, 2015 4:10 AM

Reply
9 replies

Jan 17, 2015 6:23 PM in response to baltwo

This was the script that I was using: do shell script "diskutil mount /dev/disk1s10" that I recorded a few years ago.


When I found it gave an error that it couldn't find the disk I tried recording it again when I found out that it wouldn't record.


I got info from diskutil which told me that the disk was disk1s2, not 10.


I edited the original script that gave the error correcting the disk name, saved the app, and it works fine now.


I don't know why the editor stopped working with disutil ( os update?) or why the disk designation changed but it works now.


Curious. Thanks for your interest.

Jan 17, 2015 6:42 PM in response to harvey waxman

/dev/diskNsX is a 'device node' as such it depends on the order that disks get connected.

N is the disk number, X is the session number (partition). It's not a good idea to rely on these, sometimes a disk can be slow & they get mounted in a different order - other identifiers are more stable…


diskutil mountdisk NAME-OF-DISK

or

diskutil mount [UUID]


[UUID] is a unique identifier that can be found in Disk Utility app, select the volume & use the info button to view the volume details…

Universal Unique Identifier: 12358BA8-0BA0-355E-810D-97BCDB1F3AD3


The diskutil command will also show it via the info keyword

diskutil info NAME-OF-DISK

Volume UUID: 12358BA8-0BA0-355E-810D-97BCDB1F3AD3


Pick the name or the UUID, the UUID should remain constant until you reformat, so consider that the best option.


As ever the manual helps… (see the DEVICES section near the bottom for identifier info).

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man8/diskutil.8.html

Or…

man diskutil in Terminal


P.S. Read the 10.6 manual - it's possible some identifiers are new features.

Jan 17, 2015 8:46 PM in response to harvey waxman

Here is one approach. Presents you with a selectable list of the partition names that it detects. It then tests to see if the partition is already mounted, and if not it mounts it and then informs you. Otherwise, it will tell you that it is already mounted.


-- build a list of Apple_HFS and FAT 32 mountable disks that are available

set mountList to {}


-- we can mount Apple_HFS, or FAT 32 filesystems

set mygrepTypes to "| egrep 'Apple_HFS|DOS_FAT_32' "


-- diskutil info places the partition name in these columns

set mycut to "| cut -c 34-52 "


-- trim all trailing spaces after partition names

set mysed to "| sed 's/[ ]*$//'"


-- return each mountable partition name into the list

set mountList to paragraphs of (do shell script "diskutil list " & mygrepTypes & mycut & mysed & "&")


set myPartition to (choose from listmountListwith title ¬

"Mountable Partitions List" with prompt "Please select partition to mount")


-- if the cancel button is clicked

if myPartition is false then quit


-- is the partition mounted or not

-- returns Yes or No strings

set status to (do shell script "diskutil info " & quoted form of (myPartition as text) & " | awk '/Mounted:/ {print $2}' &")


if status is "Yes" then

display dialog "Sorry, the partition " & quoted form of (myPartition as text) & " is already mounted"

else

display dialog (do shell script "diskutil mount " & quoted form of (myPartition as text))

end if

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

why won't applescript record?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.