macos - 如何在 AppleScriptObj 中获取 NSImage.Name
问题描述
在 AppleScriptObj 中。我试过了:
set cautionName to aN of NSImage.Name
但这不起作用。
解决方案
看起来您所追求的是NSImageNameCaution
,这是系统映像名称的常量。您的示例(和链接)似乎正在使用Swift
,更改文档语言以Objective-C
提供正确的术语。
AppleScriptObjC使用来自Objective-C文档的名称(它也不使用点表示法),所以它类似于:
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)
推荐阅读
- python - 使用 Pandas 中的查询从 SQL 表中删除记录
- python - 读取文件并尝试补全数据库中缺失的信息
- python - 在嵌套理解中使用海象运算符 := 的替代方法
- arrays - 如何使用 Json Extractor 从 Jmeter 中的嵌套 Json 中提取数据
- python - 如何在python中将平面列表转换为字典?
- amazon-web-services - 有没有办法在 AWS 内部路由网络流量?
- wmi - 在 UEFI 中实现 ACPI 功能
- reactjs - React PWA 中的 Firebase 云消息传递错误
- javascript - 使用 Facebook 登录 AWS Cognito
- html - html div元素透明