Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

diskutil_info handler (Was: UUID)



Just for the fun of it...

calling

   diskutil_info("/")

will give you a record of all the information diskutil -info returns.

So calling

   get |UUID| of diskutil_info("/")

will give you the UUID of the root disk.


Here is the handler...

on diskutil_info(a_disk)
return run script (do shell script "diskutil info " & (quoted form of POSIX path of a_disk) & " | perl -e " & quoted form of "
use strict;
use warnings;
my (%info, $last_key);
while (<>) {
chomp;
next if /^$/;
s/^\\s+//;
s/\\s+$//;
if (s/^(\\w[^:]+?)\\s*:\\s*//) {
$last_key= $1;
$info{ $last_key }= $_;
next;
}
$info{ $last_key }.= qq(\\n).$_ if $last_key;
}
print '{',join(',',map { qq(|$_|:).quote($info{$_}) } keys %info),'}';
sub quote {
my($txt)= @_;
$txt=~ s/\"/\\\\\"/g;
return qq(\"$txt\");
}")
end diskutil_info
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden
References: 
 >UUID (From: Luther Fuller <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.