ASOCで現在実行中のプロセスの情報を取得

AppleScript名:ASOCで現在実行中のプロセスの情報を取得
— Created 2015-09-08 by Takaaki Naganoya
— 2015 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set procInfo to current application’s NSProcessInfo’s processInfo()
–>  (NSProcessInfo) <NSProcessInfo: 0x6000000587e0>

set argList to procInfo’s arguments()
–>  (NSArray) {​​​​​"/Applications/ASObjC Explorer 4.app/Contents/MacOS/ASObjC Explorer 4"​​​}–ASObjC Explorer 4

set envList to procInfo’s environment()
–>  (NSDictionary) {​​​​​PATH:"/usr/bin:/bin:/usr/sbin:/sbin", ​​​​​TMPDIR:"/var/folders/h4/jfhlwst88xl9z0001s7k9vk00000gr/T/", ​​​​​LOGNAME:"me", ​​​​​HOME:"/Users/me", ​​​​​XPC_FLAGS:"0x0", ​​​​​Apple_PubSub_Socket_Render:"/private/tmp/com.apple.launchd.OLjjErklL4/Render", ​​​​​USER:"me", ​​​​​SSH_AUTH_SOCK:"/private/tmp/com.apple.launchd.y3g31V3gh7/Listeners", ​​​​​SECURITYSESSIONID:"XXXXX", ​​​​​DISPLAY:"/private/tmp/com.apple.launchd.63oTa9LGKM/org.macosforge.xquartz:0", ​​​​​XPC_SERVICE_NAME:"au.com.myriad-com.ASObjC-Explorer-4.69328", ​​​​​SHELL:"/bin/xxxx", ​​​​​__CF_USER_TEXT_ENCODING:"0x1F8:0x1:0xE"​​​}

set anUniqueStr to procInfo’s globallyUniqueString()
–>  (NSString) "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX-XXXX-XXXXXXXXXXXXXXXX"

set anID to procInfo’s processIdentifier()
–>  4283–Unix Process ID (pid)

set aName to procInfo’s processName()
–>  (NSString) "ASObjC Explorer 4"

set aHostName to procInfo’s hostName()
–>  (NSString) "mbpretina.local"

set aVersionStr to procInfo’s operatingSystemVersionString()
–>  (NSString) "バージョン 10.10.5(ビルド 14F27)"

set aVersion to procInfo’s operatingSystemVersion()
–> can’t bridge argument of type {_NSOperatingSystemVersion=qqq}. OS X 10.10ではブリッジ不可。10.11でOK

set aCPUCores to procInfo’s processorCount()
–>  8

set activeCPUCores to procInfo’s activeProcessorCount()
–>  8

set anRAMcapacity to procInfo’s physicalMemory()
–>  8.589934592E+9

set anRAMcapacity to procInfo’s systemUptime()
–>  6.8344782485801E+4

set aThermalState to procInfo’s thermalState()
–>  0 –NSProcessInfoThermalStateNominal
(*
enum {
NSProcessInfoThermalStateNominal,
NSProcessInfoThermalStateFair,
NSProcessInfoThermalStateSerious,
NSProcessInfoThermalStateCritical
};
*)

★Click Here to Open This Script 

Please follow and like us:

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です