0

我正在尝试使用 AppleScript Key Code 在 Google Chrome 中导航。但是,如果我将这些重复代码打包到处理程序中,处理程序将无法处理这些信息。脚本错误显示如下: 系统事件出错:无法继续 Copy_Trello。

set a to {}
set b to {}
set c to {}
set d to {}
set e to {}


on Copy_Trello(Incident, Marketplace, Core_server, Network, Others)
    tell application "System Events"
        key code 124
        delay 0.1
        key code 36
        delay 0.1
        key code 14
        delay 0.1
        key code 8 using command down
        delay 0.2
        copy (the clipboard) to the end of Incident
        delay 0.2
        key code 53
        delay 0.1
        key code 53
        delay 0.1
        key code 125
        delay 0.1
        key code 36
        delay 0.1
        key code 14
        delay 0.1
        key code 8 using command down
        delay 0.1
        copy (the clipboard) to the end of Marketplace
        delay 0.2
        key code 53
        delay 0.2
        key code 53
        delay 0.1
        key code 125
        delay 0.1
        key code 36
        delay 0.1
        key code 14
        delay 0.1
        key code 8 using command down
        delay 0.2
        copy (the clipboard) to the end of Core_server
        delay 0.2
        key code 53
        delay 0.1
        key code 53
        delay 0.1
        key code 125
        delay 0.1
        key code 36
        delay 0.1
        key code 14
        delay 0.1
        key code 8 using command down
        delay 0.2
        copy (the clipboard) to the end of Network
        delay 0.2
        key code 53
        delay 0.1
        key code 53
        delay 0.1
        key code 125
        delay 0.1
        key code 36
        delay 0.1
        key code 14
        delay 0.1
        key code 8 using command down
        delay 0.2
        copy (the clipboard) to the end of Others
        delay 0.2
        key code 53
        delay 0.1
        key code 53
        delay 0.1
    end tell
end Copy_Trello

on up_()
    tell application "System Events"
        repeat 4 times
            key code 126
            delay 0.05
        end repeat
    end tell
end up_

tell application "Google Chrome"
    open location "https://trello.com/"
    delay 4
    tell application "System Events"
        key code 125
        delay 0.3
        repeat 7 times
            Copy_Trello(a, b, c, d, e)
            delay 0.05
            up_()
            key code 124
            delay 0.05
        end repeat
    end tell
end tell

display dialog a & b & c & d & e

有什么想法吗?先感谢您。

4

0 回答 0