【问题标题】:AppleScript keystrokeAppleScript 击键
【发布时间】:2017-05-16 07:06:21
【问题描述】:

我使用一个应用,我想从这个应用中获取数据,

我在菜单栏上找到了一个按钮 > Edit > Optionwanted

我还发现该选项有一个快捷方式(C + COMD + CTRL + SHIFT)

我不确定这是不是最好的方法,但我试过了:

activate application "App"

delay 1
tell application "System Events" to keystroke "C" using {control down, command down, shift}

但是结果是

系统事件出错:无法使 {control down, command down, shift} 转换为常量类型或常量列表。

  1. 这是从应用程序获取文本的最佳方法吗?

  2. 我可以修复我的脚本。

PS:当我运行时

tell application "System Events" to tell application process "App"
    set stuff to entire contents of front window
end tell
return stuff

我可以在那里看到我想要的:

应用进程“App”,组3的静态文本“445511” group 1 of group 2 of group 5 UI element 1 of scroll area 1 of group 2 of group 1 of group 2 UI element 1 of scroll area 1 of 窗口“标题实际上不是静态的”拆分器组 1

这可以是另一种方法,但标题和文本是动态的,并且一直在变化。

【问题讨论】:

  • 在列表中尝试shift down
  • 谢谢你,你解决了这个问题,我不敢相信这会这么简单!

标签: applescript keystore


【解决方案1】:

你很接近。 这是我得到的:

activate application "App"

delay 1
tell application "System Events" 
    keystroke "C" using {control down, command down, shift down}
end tell

【讨论】:

  • Illustrator 遇到了同样的问题,我的例子 -- UNGROUP tell application "Adobe Illustrator" to activate delay 1 tell application "System Events" to tell process "Adobe Illustrator" keystroke "g" using {command down, shift down} end tell
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-22
相关资源
最近更新 更多