For example

    on run {input, parameters}

    set Variable1 to "5"

    if (Variable1 is not "5") & (Variable1 is not "6") then

        display dialog "Variable1 is not 5 or 6"


        display dialog "Variable1 is 5"

    end if

    return input
end run

When running this program, I get the error:

Can’t make {false, true} into type boolean.


The following should handle the test:

set Variable1 to "5"

if (Variable1 is not "5") and (Variable1 is not "6") then
    display dialog "Variable1 is not 5 or 6"
    display dialog "Variable1 is " & Variable1
end if
  • 1
    Just to be clear, which part of my code was incorrect: the use of the ampersand instead of "and", the parentheses, or the use of "is not" instead of "is not equal to"? – rubik's sphere Nov 18 '16 at 6:17
  • There can be more then one way to write something, sometimes it just comes down to style but the primary error was the use of the ampersand. If you just change it to and the code should run although if you set Variable1 to "6" it's going to erroneously say display dialog "Variable1 is 5", – user3439894 Nov 18 '16 at 6:26
  • But what do you mean by "primary error"? Isn't the ampersand the only error? – rubik's sphere Nov 18 '16 at 6:33
  • No the ampersand was not the only error. IMO display dialog "Variable1 is 5" was wrong as you're testing a variable and if it was set to 6 the message should say Variable1 is 6 not Variable1 is 5 so I updated my answer to reflect the two changes I'd make to your code. – user3439894 Nov 18 '16 at 6:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .