【发布时间】:2022-01-10 09:40:15
【问题描述】:
我这里有这个脚本需要挂载一个网络文件夹,验证它是否已挂载,然后启动应用程序。当 'tell application appName to activate' 在 'tell application "System Events"' 语句之外时,它可以工作。但正如下面所写,应用程序将无法打开。此外,当我用“QuickBooks”替换“appName”时,程序会打开,如下所示。
任何帮助将不胜感激。
set hostname to "TestHost"
set shareFolder to "TestShare"
set user to "TestUser"
set pw to "P@ssword"
set appName to "QuickBooks"
try
set networkPath to "/volumes/" & shareFolder
mount volume "smb://" & hostname & "/" & shareFolder as user name user with password pw
end try
tell application "System Events"
if exists folder networkPath then
tell application appName to activate
else
display alert "Unable to find QuickBooks Database."
end if
end tell
【问题讨论】:
标签: macos applescript