Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行单击按钮命令时Applescript延迟太长_Applescript - Fatal编程技术网

运行单击按钮命令时Applescript延迟太长

运行单击按钮命令时Applescript延迟太长,applescript,Applescript,我正在写一个简单的代码,点击Notes应用程序上的共享按钮 set upArrow to ASCII character 30 activate application "Notes" tell application "System Events" tell process "Notes" set frontmost to true click button 2 of group 2 of splitter group of window 1 keystroke upArrow keystro

我正在写一个简单的代码,点击Notes应用程序上的共享按钮

set upArrow to ASCII character 30
activate application "Notes"
tell application "System Events"
tell process "Notes"
set frontmost to true
click button 2 of group 2 of splitter group of window 1
keystroke upArrow
keystroke return
end tell
end tell
问题是

click button 2 of group 2 of splitter group 1 of window 1 of application process "Notes" --> missing value
它需要6秒来完成运行并返回缺少值的错误


但是,如果我不添加击键或随后的任何命令,这段代码就可以完美地工作

我也会得到延迟,并返回缺少的值。但是你能点击菜单栏上的一个项目吗

activate application "Notes"
tell application "System Events" to tell process "Notes"
    click menu item "Email" of menu 1 of menu item "Share" of menu "File" of menu bar 1
end tell

我还得到了延迟,它返回丢失的值。但是你能点击菜单栏上的一个项目吗

activate application "Notes"
tell application "System Events" to tell process "Notes"
    click menu item "Email" of menu 1 of menu item "Share" of menu "File" of menu bar 1
end tell

有一个线程似乎描述了同一个bug,它似乎仅限于特定的软件。它位于MacScripter.net上:


请注意最近一篇描述FileMaker延迟的文章。当软件出现此错误时,似乎唯一的解决方法是做其他事情来打开新窗口。如果运行所需功能的唯一方法是通过按钮,那么一个(糟糕的)选项是单击相对于前窗口角的坐标。显然,如果内容可以相对于角落移动,或者如果软件的新版本移动了所需的按钮,则很容易失败。还有其他想法吗?

有一个线程似乎描述了同一个bug,它似乎仅限于特定的软件。它位于MacScripter.net上:

set focused of button 2 of group 2 of splitter group 1 of window 1 to true
keystroke space
请注意最近一篇描述FileMaker延迟的文章。当软件出现此错误时,似乎唯一的解决方法是做其他事情来打开新窗口。如果运行所需功能的唯一方法是通过按钮,那么一个(糟糕的)选项是单击相对于前窗口角的坐标。显然,如果内容可以相对于角落移动,或者如果软件的新版本移动了所需的按钮,则很容易失败。还有其他想法吗

set focused of button 2 of group 2 of splitter group 1 of window 1 to true
keystroke space

资料来源:

资料来源:


您是在脚本编辑器中运行此脚本,还是作为小程序运行?我是在applescript编辑器中运行此脚本您的脚本适合我,至少在我的机器上是这样。它在Notes中显示“通过消息发送”功能。我所看到的和你所看到的(在你的截图中)之间的唯一区别是,你正在做“
告诉应用程序”系统事件“***告诉进程”注释“
”,我认为这有点不正确。这只是使用告诉功能的另一种方法,你的操作系统是什么,我用的是山狮。运行代码时是否存在“缺少值”。您是在脚本编辑器中运行此脚本,还是作为小程序运行?我在applescript编辑器上运行此脚本您的脚本对我有效,至少在我的计算机上是这样。它在Notes中显示“通过消息发送”功能。我所看到的和你所看到的(在你的截图中)之间的唯一区别是,你正在做“
告诉应用程序”系统事件“***告诉进程”注释“
”,我认为这有点不正确。这只是使用告诉功能的另一种方法,你的操作系统是什么,我用的是山狮。运行代码时是否存在“缺少值”。