Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.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
Macos 在约塞米蒂,击键动作往往非常缓慢_Macos_Applescript_Osx Yosemite_Keystroke_Systemevent - Fatal编程技术网

Macos 在约塞米蒂,击键动作往往非常缓慢

Macos 在约塞米蒂,击键动作往往非常缓慢,macos,applescript,osx-yosemite,keystroke,systemevent,Macos,Applescript,Osx Yosemite,Keystroke,Systemevent,我在Mac OS X 10.10 Yosemite上使用applescript。我注意到击键动作往往比10.9慢得多 下面是我的applescript,它告诉终端在Finder中输入cd我的当前路径,然后按return键: 以前,在OSX10.9中,输入当前路径的击键速度非常快,对于一个长字符串,不到1秒。然而,在10.10中,速度往往非常慢,通常超过3-4秒,这样我就可以清楚地看到正在打印的字母 此外,系统事件中的其他操作也比10.9慢,因此我必须增加延迟时间以使它们正常工作 有人能解释一下吗

我在Mac OS X 10.10 Yosemite上使用applescript。我注意到击键动作往往比10.9慢得多

下面是我的applescript,它告诉终端在Finder中输入cd我的当前路径,然后按return键:

以前,在OSX10.9中,输入当前路径的击键速度非常快,对于一个长字符串,不到1秒。然而,在10.10中,速度往往非常慢,通常超过3-4秒,这样我就可以清楚地看到正在打印的字母

此外,系统事件中的其他操作也比10.9慢,因此我必须增加延迟时间以使它们正常工作


有人能解释一下吗?或者给出另一种解决方案?谢谢

我已经在10.10的脚本编辑器中对它进行了测试,运行时间不到1秒。一定还有别的问题

使用do script命令可能会有所帮助:


感谢您的精彩解决方案!我修改了它,让应用程序终端在窗口1中执行脚本cd\¤tPath&\以达到我的要求。
tell application "Finder"
    try
        set currentFolder to (folder of the front window)
        set currentPath to (POSIX path of (target of the front window as alias))
    on error
        set currentFolder to desktop
        set currentPath to (POSIX path of (desktop as alias))
    end try
end tell

tell application "Terminal"
    activate
    delay 0.5
    tell application "System Events"
        set cdtocurrentPath to "cd \"" & currentPath & "\"" as string
        keystroke cdtocurrentPath
        keystroke return
    end tell
end tell
tell application "Terminal" to do script "cd \"" & currentPath & "\""