AppleScript名:ローカライズドな度量衡表示(エネルギー) |
— Created 2015-11-20 by Shane Stanley — Modified 2016-01-14 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" –Energy set engEFormatter to current application’s NSEnergyFormatter’s alloc()’s init() engEFormatter’s numberFormatter()’s setLocale:(current application’s NSLocale’s localeWithLocaleIdentifier:"en-US") engEFormatter’s setUnitStyle:(current application’s NSFormattingUnitStyleLong) engEFormatter’s setForFoodEnergyUse:true set a1Res to (engEFormatter’s stringFromJoules:85) as string –> "20.315 calories" engEFormatter’s setForFoodEnergyUse:false set a1Res to (engEFormatter’s stringFromJoules:85) as string –> "20.315 calories" set a2Res to (engEFormatter’s stringFromValue:1 unit:(current application’s NSEnergyFormatterUnitJoule)) as string –joule –> "1 joule" set a3Res to (engEFormatter’s stringFromValue:1 unit:(current application’s NSEnergyFormatterUnitKilojoule)) as string –k joule –> "1 kilojoule" set a4Res to (engEFormatter’s stringFromValue:1 unit:(current application’s NSEnergyFormatterUnitCalorie)) as string –Cal –> "1 calorie" set a5Res to (engEFormatter’s stringFromValue:1 unit:(current application’s NSEnergyFormatterUnitKilocalorie)) as string –K Cal –> "1 kilocalorie" set jpnEFormatter to current application’s NSEnergyFormatter’s alloc()’s init() jpnEFormatter’s numberFormatter()’s setLocale:(current application’s NSLocale’s localeWithLocaleIdentifier:"ja") jpnEFormatter’s setUnitStyle:(current application’s NSFormattingUnitStyleLong) jpnEFormatter’s setForFoodEnergyUse:true set j1Res to (jpnEFormatter’s stringFromJoules:85) as string –> "85ジュール" jpnEFormatter’s setForFoodEnergyUse:false set j1Res to (jpnEFormatter’s stringFromJoules:85) as string –> "85ジュール" set j2Res to (jpnEFormatter’s stringFromValue:1 unit:(current application’s NSEnergyFormatterUnitJoule)) as string –joule –> "1ジュール" set j3Res to (jpnEFormatter’s stringFromValue:1 unit:(current application’s NSEnergyFormatterUnitKilojoule)) as string –k joule –> "1キロジュール" set j4Res to (jpnEFormatter’s stringFromValue:1 unit:(current application’s NSEnergyFormatterUnitCalorie)) as string –Cal –> "1熱力学カロリー" set j5Res to (jpnEFormatter’s stringFromValue:1 unit:(current application’s NSEnergyFormatterUnitKilocalorie)) as string –K Cal –> "1キロカロリー" |
More from my site
(Visited 31 times, 1 visits today)