AppleScript 运行 应用程序

AppleScript Run Application

我这里有这个脚本需要挂载一个网络文件夹,验证它是否挂载,然后启动应用程序。当 'tell application appName to activate' 在 'tell application "System Events"' 语句之外时,它起作用。但正如下面所写,应用程序将无法打开。此外,当我将 'appName' 替换为“QuickBooks”时,程序将按如下所示打开。

如有任何帮助,我们将不胜感激。

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

改变

tell application appName to activate

tell me to tell application appName to activate