Thursday, February 25, 2021

#1 2021-01-18 03:06:50 am

Registered: 2019-10-23
Posts: 625

Scriptable key from runningApplicaions

Example of a script to return scriptable key from runningApplicaions


use framework "Foundation"
use framework "AppKit"
use scripting additions

set workspace to (current application's NSWorkspace's sharedWorkspace())'s runningApplications()

repeat with anApp in workspace
   set {theResult, theKey, theError} to ((anApp's bundleURL())'s getResourceValue:(reference) forKey:(current application's NSURLApplicationIsScriptableKey) |error|:(reference))
   if theResult then
       set theString to (anApp's localizedName() as text) & ", " & (theKey as string) & linefeed
       log theString
   end if
end repeat

The purpose to study someone else art is not to add, its to make less more.



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)