• 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: ID of a Disk
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ID of a Disk


  • Subject: Re: ID of a Disk
  • From: "koenig.yvan" <email@hidden>
  • Date: Wed, 19 Mar 2014 17:34:04 +0100


Le 19/03/2014 à 17:16, Michael Slomski <email@hidden> a écrit :

-----Ursprüngliche Nachricht-----
Von: Luther Fuller <email@hidden>
which required me to display SE's messy looking id format in 'choose from
list.

Hi Luther and all,

if I have such list where I want to hide the "real stuff (in this case the
ugly Ids) the I make 2 lists.
The first one is only for display, the second contains the stuff I need
later.

Every Item of the first List gets a number from 1 to x in front so I can
take the first word of the result string as offset to the right item of
the second list. By using the numbers in the displayed List the user can
type them on the keyboard and don't have to use the mouse…

Michael



Alternate version :

tell application "System Events"
set theDisks to id of every disk
end tell
set the_disks to {}
repeat with aDisk in theDisks
if (aDisk does not start with "net") and (aDisk does not start with "home") then
set end of the_disks to my recolle(items 1 thru 2 of my decoupe(aDisk, ","), ", ID ")
end if
end repeat
set myChoice to choose from list the_disks
if myChoice is false then error number -128
set shortID to item -1 of my decoupe(item 1 of myChoice, space)

tell application "System Events"
properties of first disk whose id contains "," & shortID & ","
end tell

#=====

on decoupe(t, d)
local oTIDs, l
set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
set l to text items of t
set AppleScript's text item delimiters to oTIDs
return l
end decoupe

#=====

on recolle(l, d)
local oTIDs, t
set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
set t to "" & l
set AppleScript's text item delimiters to oTIDs
return t
end recolle

#=====


Yvan KOENIG (VALLAURIS, France) mercredi 19 mars 2014 17:33:58


 _______________________________________________
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

References: 
 >Re: ID of a Disk (From: Ted Wrigley <email@hidden>)
 >Re: ID of a Disk (From: Luther Fuller <email@hidden>)
 >Re: ID of a Disk (From: "koenig.yvan" <email@hidden>)
 >Re: ID of a Disk (From: Ron Hunsinger <email@hidden>)
 >Re: ID of a Disk (From: Luther Fuller <email@hidden>)
 >Re: ID of a Disk (From: Michael Slomski <email@hidden>)

  • Prev by Date: Re: ID of a Disk
  • Next by Date: Re: Scope riddle I can't seem to solve. (Probably very easy to solve for an experienced coder)
  • Previous by thread: Re: ID of a Disk
  • Next by thread: Sorting lists of strings and lists of lists in Applescript
  • Index(es):
    • Date
    • Thread