Can't use SafariURL

I have this macro:

15

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

However this works:

17

What am I doing wrong?

Do you mean the %SafariURL% token ?

image

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,

Da.

β€œ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)
image

Nyet.

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?

-Chris

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: