首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在脚本字典中更改类列表的属性?

如何在脚本字典中更改类列表的属性?
EN

Stack Overflow用户
提问于 2021-10-19 01:49:02
回答 1查看 87关注 0票数 0

我在应用程序脚本字典中看到了要修改的属性。它位于一个类中,但我找不到修改它的方法。有没有办法修改它?

我尝试了以下方法,但得到一个错误:

代码语言:javascript
复制
tell application "Capture One 21"
    activate
    
    set image location of next capture options to "/tmp"
end tell

输出:

代码语言:javascript
复制
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尝试获取此配置时,我也得到了一个错误:

代码语言:javascript
复制
tell application "Capture One 20"
    activate
    
    get image location of next capture options
end tell

输出:

代码语言:javascript
复制
error "Can’t get image location of next capture options." number -1728 from «class viil» of «class CncO»

-1728表示“引用的对象不存在”,但我使用的是pro版本。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-20 05:51:57

谢谢你的帮助,@Robert Kniazidis。使用Script Debugger,我发现实际的设置项不是next capture options,而是next capture settings,而且它位于document下,因此获得此配置值的实际方法是get image location of next capture settings of document 1。但最终它真的无法设置,因为需要企业版。

最后,我找到了一种方法来模拟和操作UI元素,以达到我想要的效果:

代码语言:javascript
复制
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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69624261

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档