【问题标题】:AppleScript Run ApplicationAppleScript 运行应用程序
【发布时间】: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


    【解决方案1】:

    改变

    tell application appName to activate
    

    tell me to tell application appName to activate
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-23
      • 1970-01-01
      • 1970-01-01
      • 2021-04-14
      • 2013-08-24
      • 2016-03-08
      相关资源
      最近更新 更多