Can't use SafariURL

I have this macro:


My problem is that it seems to be failing to check SafariURL variable. I am sure I have a URL opened which contains inside it but it still doesn't go through the if case.

However this works:


What am I doing wrong?

Do you mean the %SafariURL% token ?


You are right. I just thought you can do an if check on the tokens. And thought of tokens as variables too.

Thank you.

1 Like

Hey Nikita,


β€œAll tokens return a text value, even if the source data was some other data type.”

Think of them as text tokens that can only be used in text fields.

If Then Else.kmactions (1.4 KB)


A token is essentially a call that produces a specific value.

That value is not stored and hence is not a variable.

The %SafariURL% text token is shorthand for:

tell application "Safari" to return URL of front document

You wouldn't think of this AppleScript as a variable. It's a call that produces a value.

Does this make more sense?


1 Like

It certainly does. Thank you very much for both informative and amusing explanation. :slightly_smiling_face:

You probably noticed part of your script at the top too. It's too good. :unicorn: