Applescript 字符串比较在Alfred中永远不会计算为true
我正在为Alfred工作流程编写脚本。但是,字符串比较的计算结果永远不会为true 脚本中的Applescript 字符串比较在Alfred中永远不会计算为true,applescript,alfred,Applescript,Alfred,我正在为Alfred工作流程编写脚本。但是,字符串比较的计算结果永远不会为true 脚本中的“{query}”确实被正确的ctext值类型替换,我可以使用display dialog“{query}”和“{query}”的display dialog类将其正面替换 我也尝试过使用如果“{query}”=“a”,那么,但仍然有相同的结果 评估一直落在else语句上 在编写条件语句时,我指的是下面的文章 这不正常,请使用此脚本进行调试,可能字符串包含不可见字符 set t to "{query}"
“{query}”
确实被正确的ctext
值类型替换,我可以使用display dialog“{query}”
和“{query}”的display dialog类将其正面替换
我也尝试过使用如果“{query}”=“a”,那么
,但仍然有相同的结果
评估一直落在else
语句上
在编写条件语句时,我指的是下面的文章
这不正常,请使用此脚本进行调试,可能字符串包含不可见字符
set t to "{query}"
display dialog "The ID of 'a' is " & id of "a" --> the id of a is 97
repeat with i in t -- check the id of every character in "{query}"
display dialog "The ID of '" & i & "' is " & id of i
end repeat
if t is equal to "a" then
say "in the a case"
else
say "in the else case"
end if
选中“双引号”和“反斜杠”复选框以设置转义AppleScript@jackjr300谢谢你的评论。选中转义复选框后,评估仍然为false。是的,您是正确的。{query}
中的第一个字符是带有char code32
的空字符。上面的代码对于调试是有效的。谢谢
set t to "{query}"
display dialog "The ID of 'a' is " & id of "a" --> the id of a is 97
repeat with i in t -- check the id of every character in "{query}"
display dialog "The ID of '" & i & "' is " & id of i
end repeat
if t is equal to "a" then
say "in the a case"
else
say "in the else case"
end if