Macos AppleScript';s tell语句无条件打开firefox,忽略封闭的if块
我遇到以下问题 剧本Macos AppleScript';s tell语句无条件打开firefox,忽略封闭的if块,macos,applescript,Macos,Applescript,我遇到以下问题 剧本 osascript <<EOF if false is true tell application "Firefox" to activate end if EOF osascriptFirefox不支持AppleScript,因为它不包含AppleScript字典文件,例如在其应用程序包的资源文件夹中不包含Firefox.sdef,并且只支持标准套件的一些基本命令 要防止使用OP中显示的代码打开Firefox,您需要标记(设置为变量)其
osascript <<EOF
if false is true
tell application "Firefox" to activate
end if
EOF
osascriptFirefox不支持AppleScript,因为它不包含AppleScript字典文件,例如在其应用程序包的资源文件夹中不包含Firefox.sdef,并且只支持标准套件的一些基本命令
要防止使用OP中显示的代码打开Firefox,您需要标记(设置为变量)其名称,如下例所示:
osascript
osascript <<EOF
if false is true
set appName to "Firefox"
tell application appName to activate
end if
EOF
osascript <<EOF
if false is true
set |Firefox| to "Firefox"
tell application |Firefox| to activate
end if
EOF