• 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: "koenig.yvan" <email@hidden>
  • Date: Mon, 28 Apr 2014 16:10:57 +0200


Le 28/04/2014 à 15:26, Nigel Garvey <email@hidden> a écrit :

I wrote on Mon, 28 Apr 2014 09:55:39 +0100, I wrote:

Or the same can be achieved with:

set theVolumeNamesList to paragraphs of (do shell script "diskutil
list |
sed -En '/[^[:alpha:]]+Apple_HFS / {s///;s/[[:blank:]]{2}.+$//p;}'")

Yvan's pointed out to me off-list that the disk IDs are needed too.
That's fairly easy to arrange:

 set theVolumeNamesandIDsList to paragraphs of (do shell script "diskutil list | sed -En '/[^[:alpha:]]+Apple_HFS +/ {s///;s/[[:blank:]]+[0-9.]+[[:blank:]]+[A-Z]+[[:blank:]]+([[:alnum:]]+)$/\\'$'\\n''\\1/p;}'")

 set theVolumeNamesList to {}
 set theIDsList to {}
 repeat with i from 1 to (count theVolumeNamesandIDsList) by 2
   set end of theVolumeNamesList to item i of theVolumeNamesandIDsList
   set end of theIDsList to item (i + 1) of theVolumeNamesandIDsList
 end repeat

However, Shane's posted a solution which Yvan tells me doesn't truncate
long names (an effect of "diskutil list" by itself), so that'll be
better.

NG


Oops, I forgot to send the example of truncation in this area.

Using Diskutil I got :
(*Macintosh HD, Samsung 32, archives AppleScript...*)
(*disk0s2, disk1s2, disk2s2*)

Using Shane's code I got :

(*Macintosh HD, Samsung 32, archives AppleScript_Users*)
(*disk0s2, disk1s2, disk2s2*)

As you may see, Diskutil is limited to 22 characters per volume name and when it truncates, it doesn't use the ellipsis character but three dots so that in fact only 19 characters are meaningful.
If the goal is to allow the user to select a volume from Choose From List it seems that it may be annoying.

Yvan KOENIG (VALLAURIS, France) lundi 28 avril 2014 16:10:15







 _______________________________________________
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: Considerable simplification should be possible (From: Nigel Garvey <email@hidden>)
 >Re: Considerable simplification should be possible (From: Nigel Garvey <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