我试图在 OSX Mountain Lion 上创建一个快捷方式,以便与 LogMeIn 应用程序“共享文件”,因为该应用程序不存在。我打开 Automator 并在“看我做”下创建了一个应用程序。我单击记录并导航到菜单栏,然后单击“LogMeIn”>“共享文件...”,然后单击该对话框中的“共享文件”并停止记录。然后,我将 Automator 中的命令复制并粘贴到 AppleScript 编辑器中,希望能够更改一些内容以使其执行得更快。我在 Automator 中选择了 10 倍的速度,但从我执行快捷方式开始仍然需要大约 13 秒。如果有人知道如何更改此 AppleScript 以使其即时生效,请随时更改。
任何帮助,将不胜感激。
谢谢
-- Click the “<fill in title>” menu.
set timeoutSeconds to 2.0
set uiScript to "click menu bar item 1 of menu bar 1 of application process \"LogMeIn Menubar\""
my doWithTimeout(uiScript, timeoutSeconds)
-- Share a file...
set timeoutSeconds to 2.0
set uiScript to "click menu item \"Share a file...\" of menu 1 of menu bar item 1 of menu bar 1 of application process \"LogMeIn Menubar\""
my doWithTimeout(uiScript, timeoutSeconds)
-- Click the “Share a file...” button.
set timeoutSeconds to 2.0
set uiScript to "click UI Element \"Share a file...\" of group 1 of window \"LogMeIn\" of application process \"LogMeIn\""
my doWithTimeout(uiScript, timeoutSeconds)
on doWithTimeout(uiScript, timeoutSeconds)
set endDate to (current date) + timeoutSeconds
repeat
try
run script "tell application \"System Events\"
" & uiScript & "
end tell"
exit repeat
on error errorMessage
if ((current date) > endDate) then
error "Can not " & uiScript
end if
end try
end repeat
end doWithTimeout