AppleScript使用结束键和向上箭头

时间:2016-12-20 19:14:50

标签: applescript osx-snow-leopard

我正在尝试创建一个Apple脚本,将名为Panorama的应用程序中的数据复制并粘贴到Excel 2011 for Mac。我的一切工作几乎都是我想要的方式,除非有excel移动到相邻列并移动到第一个记录位置(键盘快捷键是" end"键和向上箭头。我我不确定如何让applecript结合向上箭头来识别结束键。如果有人能告诉我如何做到这一点或其他方式,我们将非常感激。

到目前为止,这是我的代码:

重复2次

repeat 2 times

    tell application "Panorama" to activate
    tell application "System Events"
        tell process "Panorama"
            keystroke "c" using command down
            tell application "System Events" to keystroke (ASCII character 31)
        end tell
    end tell

    delay 0.8

    tell application "Microsoft Excel" to activate
    tell application "System Events"
        tell process "Microsoft Excel"
            keystroke "v" using command down
            tell application "System Events" to keystroke (ASCII character 31)
        end tell
    end tell

    delay 0.8

end repeat

tell application "Panorama" to activate
tell application "System Events"
    tell process "Panorama"
        tell application "System Events" to keystroke (ASCII character 29)
        tell application "System Events" to key code 115

    end tell
end tell

delay 0.8

tell application "Microsoft Excel" to activate
tell application "System Events"
    tell process "Microsoft Excel"
        tell application "System Events" to keystroke (ASCII character 29)
        tell application "System Events" to keystroke End using up arrow <----(This is the part not working.)
    end tell
end tell

delay 0.8

结束重复

1 个答案:

答案 0 :(得分:0)

tell application "System Events" to key code 119 -- End key
tell application "System Events" to key code 124 -- right arrow

See this reference page of key codes