【发布时间】:2017-05-17 06:47:39
【问题描述】:
我试图找出最前面的应用程序 x 是什么,运行一个脚本,然后使用 applescript 将 x 设置为最前面的应用程序。
tell application "System Events"
set frontApp to displayed name of first process whose frontmost is true
set apptemp to frontApp
end tell
[代码在这里]
tell application "System Events"
set frontmost of process whose name is apptemp to true
end tell
虽然这段代码没有返回任何错误,但它不起作用。我也试过这段代码
tell application "System Events"
set apptemp to application "Google Chrome"
set frontmost of process "Google Chrome" to true
end tell
但同样,虽然没有错误,但它不会起作用。
另外,请有人告诉管理员,以便更轻松地显示代码。我在这个网站上显示代码最困难。每行代码都要缩进四个空格,太疯狂了。
【问题讨论】:
-
关于帮助中的代码缩进:您也可以选择文本并按 CTRL+K 切换缩进为代码。
-
他们需要在网页上更清楚地说明这一点。
标签: applescript