• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Considerable simplification should be possible
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Considerable simplification should be possible


  • Subject: Re: Considerable simplification should be possible
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 29 Apr 2014 09:04:52 +1000

On 29 Apr 2014, at 8:12 am, Lists <email@hidden> wrote:

For example, Shane's (and everyones) script returns two lists. namesArray and idArray. How do I get the script to know that by picking "Condor" from the first list, I want it to pass "disk3s2" to the mount command?

Like this:

set namesArray to {}
set idArray to {}
set theText to do shell script "diskutil list -plist"
tell application "System Events"
set diskInfo to AllDisksAndPartitions of (get value of (make property list item with properties {text:theText}))
end tell
repeat with aDisk in diskInfo
repeat with aPartition in Partitions of aDisk
if |Content| of aPartition is "Apple_HFS" then
set end of namesArray to VolumeName of aPartition
set end of idArray to DeviceIdentifier of aPartition
end if
end repeat
end repeat
set volumeChoice to (choose from list namesArray with prompt "Choose a volume to mount.")
if volumeChoice is not false then
set volumeChoice to item 1 of volumeChoice
repeat with i from 1 to count of namesArray
if item i of namesArray = volumeChoice then
set theID to item i of idArray
exit repeat
end if
end repeat
end if
do shell script "diskutil mount " & theID

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Considerable simplification should be possible
      • From: G Wood <email@hidden>
    • Re: Considerable simplification should be possible
      • From: Stan Cleveland <email@hidden>
References: 
 >Re: Considerable simplification should be possible (From: Lists <email@hidden>)

  • Prev by Date: Re: Considerable simplification should be possible
  • Next by Date: Re: Considerable simplification should be possible
  • Previous by thread: Re: Considerable simplification should be possible
  • Next by thread: Re: Considerable simplification should be possible
  • Index(es):
    • Date
    • Thread