NSRunningApplicationでアプリケーションプロセス情報を取得

AppleScript名:NSRunningApplicationでアプリケーションプロセス情報を取得
— Created 2017-09-17 15:27:23 +0900 by Takaaki Naganoya
— 2017 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit"

set aBundleID to "com.apple.Safari"

set appArray to current application’s NSRunningApplication’s runningApplicationsWithBundleIdentifier:aBundleID
if appArray’s |count|() = 0 then its return

set appItem to appArray’s objectAtIndex:0

set iconRes to (appItem’s icon())
(*
–>  (NSImage) <NSImage 0x618001478f40 Size={32, 32} Reps=(
"<NSIconRefImageRep:0x61800029b300 iconRef=0x8403 size:128×128 pixels:128×128>",
"<NSIconRefImageRep:0x61800089f7c0 iconRef=0x8403 size:128×128 pixels:256×256>",
"<NSIconRefImageRep:0x6180006989c0 iconRef=0x8403 size:256×256 pixels:256×256>",
"<NSIconRefImageRep:0x61800129f040 iconRef=0x8403 size:256×256 pixels:512×512>",
"<NSIconRefImageRep:0x618000898dd0 iconRef=0x8403 size:512×512 pixels:512×512>",
"<NSIconRefImageRep:0x61800029a270 iconRef=0x8403 size:48×48 pixels:48×48>",
"<NSIconRefImageRep:0x618000691490 iconRef=0x8403 size:36×36 pixels:36×36>",
"<NSIconRefImageRep:0x618000c8e100 iconRef=0x8403 size:36×36 pixels:72×72>",
"<NSIconRefImageRep:0x618000a80460 iconRef=0x8403 size:32×32 pixels:32×32>",
"<NSIconRefImageRep:0x6180004899c0 iconRef=0x8403 size:32×32 pixels:64×64>",
"<NSIconRefImageRep:0x61800089db50 iconRef=0x8403 size:18×18 pixels:18×18>",
"<NSIconRefImageRep:0x618001291530 iconRef=0x8403 size:18×18 pixels:36×36>",
"<NSIconRefImageRep:0x618000c8e0b0 iconRef=0x8403 size:16×16 pixels:16×16>",
"<NSIconRefImageRep:0x618000880280 iconRef=0x8403 size:16×16 pixels:32×32>",
"<NSIconRefImageRep:0x618000e99a50 iconRef=0x8403 size:512×512 pixels:1024×1024>"
)>
*)


set locRes to (appItem’s localizedName()) as string
–>  "Safari"

set bID to (appItem’s bundleIdentifier()) as string
–>  "com.apple.Safari"

set bURL to (appItem’s bundleURL()) as string
–>  "Cherry:Applications:Safari.app:"

set arch to (appItem’s executableArchitecture())
–>  16777223

set exeURL to (appItem’s executableURL())
–>  (NSURL) file:///Applications/Safari.app/Contents/MacOS/Safari

set launchDate to (appItem’s launchDate())
–>  (NSDate) 2017-09-13 01:58:16 +0000

set launchFinish to (appItem’s finishedLaunching) as integer
–>  1

set pID to (appItem’s processIdentifier) as integer
–>  11877

set oenMenu to (appItem’s ownsMenuBar()) as boolean
–>  false

★Click Here to Open This Script 

Please follow and like us:

コメントを残す

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