告诉应用程序 - 字符串与字符串?
问题描述:
如果我运行:告诉应用程序 - 字符串与字符串?
tell application "Maps"
set miniaturized of windows to false
end tell
...这工作正常
然而,当我运行:
set applicationName to "Maps"
tell application applicationName
set miniaturized of windows to false
end tell
...我得到:
地图得到了一个错误:无法使|小型化|每个窗口的类型引用。
我也试过:
tell application (applicationName as string)
...
end tell
...但我得到同样的错误。
我是Apple新手,不太了解两者之间的细微差别。
答
tell application
的参数需要是文字字符串(常量),因为术语是在编译时计算的。
另一种方法是using terms from application
块,但参数需要一个字符串,也
using terms from application "Maps"
end using terms from
我也在运行Sierra(10.12.6),但这两个都不能在我的机器上运行。它们不会产生任何错误,但它们也不会恢复窗口。 – Jeff