如何更改脚本词典中 class 列表中的 属性?
How do I change property of class listing in scripting dictionary?
我在应用程序脚本词典中看到了我要修改的属性。它位于class,但我找不到修改它的方法。有办法修改吗?
我尝试了以下方法,但出现错误:
tell application "Capture One 21"
activate
set image location of next capture options to "/tmp"
end tell
输出:
error "Can’t set «class viil» of «class CncO» to \"/tmp\"." number -10006 from «class viil» of «class CncO» to «class /tmp»
错误代码 -10006 表示“写操作被拒绝”。
我在使用get image location of next capture options
尝试获取这个配置时,也报错:
tell application "Capture One 20"
activate
get image location of next capture options
end tell
输出:
error "Can’t get image location of next capture options." number -1728 from «class viil» of «class CncO»
-1728表示“引用的对象不存在”,但我用的是专业版
感谢 @Robert Kniazidis 的帮助。使用Script Debugger,发现实际的设置项不是next capture options
,而是next capture settings
,并且位于document
下,所以实际获取这个配置值的方式是[=14] =].但是最后真的设置不了,因为需要企业版。
最后,我找到了一种模拟和操作UI元素的方法,达到了我想要的效果:
tell application "Capture One 20"
activate
end tell
tell application "System Events"
tell process "Capture One 20"
click radio button 2 of radio group 1 of window 1
delay 0.1
global destination
set destination to 0
repeat with g in every group of window 1
repeat with sa in every scroll area of g
if exists of group "NextCaptureLocation" of sa then
set nextCaptureLocation to group "NextCaptureLocation" of sa
if exists of group "目的地" of nextCaptureLocation then
set destination to group "目的地" of nextCaptureLocation
end if
if exists of group "Destination" of nextCaptureLocation then
set destination to group "Destination" of nextCaptureLocation
end if
end if
end repeat
end repeat
if destination = 0 then
display notification "Cannot obtain target element Destination" with title "AppleScript Error"
return
end if
click pop up button 1 of destination
click menu item -1 of menu 1 of pop up button 1 of destination
delay 1
key code 5 using {shift down, command down}
delay 1
key code 0 using {command down} -- command + A
key code 51
delay 1
set the clipboard to "/tmp"
key code 9 using {command down} -- command + v
delay 1
keystroke return
delay 1
keystroke return
end tell
end tell
我在应用程序脚本词典中看到了我要修改的属性。它位于class,但我找不到修改它的方法。有办法修改吗?
我尝试了以下方法,但出现错误:
tell application "Capture One 21"
activate
set image location of next capture options to "/tmp"
end tell
输出:
error "Can’t set «class viil» of «class CncO» to \"/tmp\"." number -10006 from «class viil» of «class CncO» to «class /tmp»
错误代码 -10006 表示“写操作被拒绝”。
我在使用get image location of next capture options
尝试获取这个配置时,也报错:
tell application "Capture One 20"
activate
get image location of next capture options
end tell
输出:
error "Can’t get image location of next capture options." number -1728 from «class viil» of «class CncO»
-1728表示“引用的对象不存在”,但我用的是专业版
感谢 @Robert Kniazidis 的帮助。使用Script Debugger,发现实际的设置项不是next capture options
,而是next capture settings
,并且位于document
下,所以实际获取这个配置值的方式是[=14] =].但是最后真的设置不了,因为需要企业版。
最后,我找到了一种模拟和操作UI元素的方法,达到了我想要的效果:
tell application "Capture One 20"
activate
end tell
tell application "System Events"
tell process "Capture One 20"
click radio button 2 of radio group 1 of window 1
delay 0.1
global destination
set destination to 0
repeat with g in every group of window 1
repeat with sa in every scroll area of g
if exists of group "NextCaptureLocation" of sa then
set nextCaptureLocation to group "NextCaptureLocation" of sa
if exists of group "目的地" of nextCaptureLocation then
set destination to group "目的地" of nextCaptureLocation
end if
if exists of group "Destination" of nextCaptureLocation then
set destination to group "Destination" of nextCaptureLocation
end if
end if
end repeat
end repeat
if destination = 0 then
display notification "Cannot obtain target element Destination" with title "AppleScript Error"
return
end if
click pop up button 1 of destination
click menu item -1 of menu 1 of pop up button 1 of destination
delay 1
key code 5 using {shift down, command down}
delay 1
key code 0 using {command down} -- command + A
key code 51
delay 1
set the clipboard to "/tmp"
key code 9 using {command down} -- command + v
delay 1
keystroke return
delay 1
keystroke return
end tell
end tell