appleScript应用示例
appleScript应用示例,控制 Capture One
·
最近遇到个利用 appleScript 脚本控制 Capture One 的需求,譬如更改图片的曝光。
这块主要是参考 Capture One 的脚本字典,代码如下:
tell application "Capture One 22"
tell front variant of document 1
set the ev to exposure of adjustments
set the ev to ev - 0.1
set exposure of adjustments to ev
return exposure of adjustments
end tell
end tell
如上,只要在脚本编辑器中点击执行,当前图片曝光参数即减去 0.1,这块可以自定义设置或更友好的单独提出来。
代码中还可以看到,应用 Capture One 22 是写死的,如果版本换了呢?所以有必要根据关键字直接拿到应用名称,代码如下:
tell application "System Events"
repeat with var in application processes
set appName to name of var
if appName begins with "Capture" then
return appName
end if
end repeat
end tell
思路就是循环遍历每个应用进程,拿 Capture 关键字去匹配。执行后拿到的返回值就是 Capture One 22,但效率有待提高。
以上。
更多推荐
已为社区贡献4条内容
所有评论(0)