diskutil_info handler (Was: UUID)
diskutil_info handler (Was: UUID)
- Subject: diskutil_info handler (Was: UUID)
- From: Skeeve <email@hidden>
- Date: Thu, 31 Jan 2008 22:02:00 +0100
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:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
References: | |
| >UUID (From: Luther Fuller <email@hidden>) |