I am writing a script for an Alfred workflow. However, the string comparison never evaluates true.
The "{query}"
inside the script does get replaced with a correct ctext
value type which I can obverse using display dialog "{query}"
and display dialog class of "{query}"
.
if "{query}" is equal to "a" then
say "in the a case"
else
say "in the else case"
end if
I have also tried use if "{query}" = "a" then
but still have the same outcome.
The evaluation keeps falling to the else
statement.
I am referring the article below when writing the conditional statements.
http://computers.tutsplus.com/tutorials/if-and-if-else-applescript-conditional-statements--mac-45590
It's not normal, debug it with this script, maybe the string contains an invisible character.
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