How to get NSImage.Name.cautionName
in AppleScriptObj. I tried:
set cautionName to aN of NSImage.Name
but that does not work.
CodePudding user response:
It looks like what you are after is NSImageNameCaution
, which is a constant for the name of a system image. Your example (and link) appear to be using Swift
, changing the documentation language to Objective-C
gives you the proper term.
AppleScriptObjC uses names from the Objective-C documentation (it also does not use dot notation), so it would be something like:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "AppKit"
use scripting additions
# get the name
set imageName to (current application's NSImageNameCaution) as text
# get the image
set theImage to current application's NSImage's imageNamed:(current application's NSImageNameCaution)
CodePudding user response:
It needs pipes to indicate that it is method
set cautionName to (anImage's |name|()) as text
NOTE: if the Image has not the associated name, then of course you will get missing value.