AppleScript,为什么先 "display alert" 起作用,然后导致 AppleScript 图标跳动,等待我点击它直到出现另一个对话框?
AppleScript, why does first "display alert" work but then cause AppleScript icon to bounce, waiting for me to click it until I get another dialog?
注意:我没有管理员权限,不能使用需要帮助或可访问性或其他任何东西的东西!
我基本上是在尝试编写一个脚本的执行,通过打开应用程序、定位它们等来设置我的 macOS 桌面
其中一部分是允许我在执行某些由于限制而必须手动执行的操作后单击继续对话(例如定位一些应用程序)。
我可以成功弹出第一个警报,当我按确定时,它会执行任务,但是第二个警报隐藏在 AppleScript 后面,直到我单击 AppleScript 才会弹出。有人知道为什么吗?
这是我所拥有的,请记住我没有管理员权限,这意味着我无法使用系统事件:
tell application "Script Editor"
set miniaturized of window 1 to true
end tell
display alert "App is opening. Make sure you log-out of Apple Connect!"
delay 3
tell application "Safari"
activate
make new document
set the bounds of the front window to {1077, 23, 1581, 464}
tell window 1
set URL of tab 1 to "http://appwebsite.com"
end tell
end tell
display alert "Set up App, sign into Apple then click OK to open all other Safari windows"
delay 1
tell application "Test Task App" to activate
在 display alert
命令 之前放置一个 activate
命令 这样 脚本编辑器 有焦点并且 display alert
命令 不会被隐藏。
示例:
activate
display alert "Set up App, sign into Apple then click OK to open all other Safari windows"
在第一个之前你不需要它,因为 脚本编辑器 有焦点,它运行第一个 display alert
命令 , 但是一旦你 activate
Safari, display alert
command 就落后于 Safari.因此,如果您在 display alert
command 之前使用 activate
command,它会将其置于前面,在此案例,Safari.
注意:我没有管理员权限,不能使用需要帮助或可访问性或其他任何东西的东西!
我基本上是在尝试编写一个脚本的执行,通过打开应用程序、定位它们等来设置我的 macOS 桌面 其中一部分是允许我在执行某些由于限制而必须手动执行的操作后单击继续对话(例如定位一些应用程序)。
我可以成功弹出第一个警报,当我按确定时,它会执行任务,但是第二个警报隐藏在 AppleScript 后面,直到我单击 AppleScript 才会弹出。有人知道为什么吗?
这是我所拥有的,请记住我没有管理员权限,这意味着我无法使用系统事件:
tell application "Script Editor"
set miniaturized of window 1 to true
end tell
display alert "App is opening. Make sure you log-out of Apple Connect!"
delay 3
tell application "Safari"
activate
make new document
set the bounds of the front window to {1077, 23, 1581, 464}
tell window 1
set URL of tab 1 to "http://appwebsite.com"
end tell
end tell
display alert "Set up App, sign into Apple then click OK to open all other Safari windows"
delay 1
tell application "Test Task App" to activate
在 display alert
命令 之前放置一个 activate
命令 这样 脚本编辑器 有焦点并且 display alert
命令 不会被隐藏。
示例:
activate
display alert "Set up App, sign into Apple then click OK to open all other Safari windows"
在第一个之前你不需要它,因为 脚本编辑器 有焦点,它运行第一个 display alert
命令 , 但是一旦你 activate
Safari, display alert
command 就落后于 Safari.因此,如果您在 display alert
command 之前使用 activate
command,它会将其置于前面,在此案例,Safari.