AppleScript名:CocoaでDiskSpace(%)を求める |
— Created 2015-04-01 by Takaaki Naganoya — 2015 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aPath to current application’s NSString’s stringWithString:"/" set fileAttr to current application’s NSFileManager’s defaultManager()’s attributesOfFileSystemForPath:aPath |error|:(missing value) set fRes to (fileAttr’s objectForKey:(current application’s NSFileSystemFreeSize)) as string set aDecNum to current application’s NSDecimalNumber’s decimalNumberWithString:fRes set aFreeNum to aDecNum’s decimalNumberByDividingBy:(current application’s NSDecimalNumber’s decimalNumberWithString:"1000000000") –"G" Bytes for Storage set bFreeNum to aFreeNum as real –> 84.058387756348 |
More from my site
(Visited 31 times, 1 visits today)