AppleScript名:NSByteCountFormatterCountStyleで数値から容量を表すテキストに変換 |
— Created 2014-12-03 by Takaaki Naganoya — 2014 Piyomaru Software use AppleScript version "2.5" use scripting additions use framework "Foundation" –NSByteCountFormatterCountStyle property NSByteCountFormatterCountStyleFile : 0 property NSByteCountFormatterCountStyleMemory : 1 property NSByteCountFormatterCountStyleDecimal : 2 property NSByteCountFormatterCountStyleBinary : 3 set a to 100000 –ファイル容量 set b to current application’s NSByteCountFormatter’s stringFromByteCount:a countStyle:(current application’s NSByteCountFormatterCountStyleFile) set c to b as string log result –> "100 KB" –メモリー容量 set d to current application’s NSByteCountFormatter’s stringFromByteCount:a countStyle:(current application’s NSByteCountFormatterCountStyleMemory) set e to b as string log result –> "100 KB" –10進数 set f to current application’s NSByteCountFormatter’s stringFromByteCount:a countStyle:(current application’s NSByteCountFormatterCountStyleDecimal) set g to b as string log result –> "100 KB" –バイナリ? set h to current application’s NSByteCountFormatter’s stringFromByteCount:a countStyle:(current application’s NSByteCountFormatterCountStyleBinary) set i to b as string log result –> "100 KB" |
More from my site
(Visited 33 times, 1 visits today)