AppleScript名:USBに接続されたUSBメモリの情報を取得する v2 |
set tmpPath to POSIX path of (path to temporary items from system domain) set aFileName to (do shell script "/usr/bin/uuidgen") set outPath to tmpPath & aFileName & ".plist" do shell script "/usr/sbin/system_profiler -xml SPUSBDataType > " & outPath tell application "System Events" set vRec to value of property list file (outPath as string) set v1Rec to _items of (first item of vRec) set dList to {} set sList to {} repeat with i in v1Rec set hitF to false try set j to _items of i set hitF to true end try if hitF = true then repeat with jj in j try set jjj to volumes of jj set sNum to d_serial_num of jj set vStr to b_vendor_id of jj repeat with ii in jjj set the end of dList to {serialNum:sNum, venderName:vStr, dData:contents of ii} end repeat end try end repeat end if end repeat end tell dList –> {{serialNum:"7f12db856195ef", venderName:"0x056e (Elecom Co., Ltd.)", dData:{mount_point:"/Volumes/NO NAME", _name:"NO NAME", writable:"yes", bsd_name:"disk2s1", free_space:"3.75 GB", file_system:"MS-DOS FAT32", |size|:"3.77 GB"}}, {serialNum:"M004101800001", venderName:"0x4146", dData:{mount_point:"/Volumes/ぴよまる", _name:"ぴよまる", writable:"yes", bsd_name:"disk1s9", free_space:"56 MB", file_system:"HFS+", |size|:"123.1 MB"}}} |
More from my site
(Visited 102 times, 1 visits today)