appleScript应用示例

        最近遇到个利用 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,但效率有待提高。

        以上。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值