Variable does not seem to be set

Hello !

I'm beginning to use Keyboard Maestro and I think I'm making a rookie mistake, but I don't see any useful answers here and I can't understand what I'm doing wrong myself. So maybe you could help me…

I'm trying to set a variable from the current browser URL, using the token FrontBrowserURL. In the set variable action, the correct URL is picked up by Keyboard Maestro, but then, it's as if the variable does not exist at all.

Here's what I have :

As you can see, the condition is currently false, and if I try to display the variable, I have only an empty string.

What am I missing ? Thanks !

Nicolas

Hi Nicolas,

Have you tried running the macro yet, or used the "Try" button at the bottom of the editor while the "Set Variable" action is selected? Until you do either of those things (or manually create the variable in KM's preferences) the urlVideo variable won't exist, which is why the condition currently shows "false" and it only shows an empty string when displayed.

I have tried to run the macro multiple times, including some debugging step using the display text action.

I didn't use the "Try" button until now, but I just did and I did not saw any difference.

And I just checked, the variable is in the KM preferences :

So it should exist, but the condition is still false.

Hmm, that's certainly strange; an identical macro works fine for me:

image

By any chance, are you using Chrome for the front browser? There are some problems with the current release version of Chrome that prevent KM's browser actions from functioning properly; it's possible that could explain what you're seeing.

Unfortunately, I'm using only latest Safari for my tests.

Maybe it's a bug also with Safari 12 ?

No, I'm using Safari 12 too, and it worked fine. Just for the hell of it, here's the test macro I used that I know works on my system:

Example Macro.kmmacros (2.4 KB)
image

Try downloading that and seeing if it works or if the same problem occurs.

By the way, what version of macOS and KM are you using? I'm on 10.13.6 and 8.2.4 myself.

You can see the token is working because Keyboard Maestro is showing you what it will set the variable to (at the bottom of the action).

You can also see the variable is currently empty.

If clicking Try on the action does not set the variable, then my guess is your variable database has become corrupted somehow.

Select Help ➤ Open Preferences Folder

and then move your “Keyboard Maestro Variables.sqlite” file to your desktop, then relaunch the Keyboard Maestro Engine and Keyboard Maestro editor.

See if that resolves the problem.

You might like to send the broken “Keyboard Maestro Variables.sqlite” file to support so I can see if I can duplicate the corruption and then auto-detect it and reset the database.

I think there is an issue somewhere with this file… I followed the procedure, but it's still not working. The database is created upon reopening, but I can't register a new variable.

Looking quickly inside the database, I saw earlier variables I created, but on a different computer. Maybe it's the source of the problem ?

Anyway, I'm sending you the file by mail to see if you can debug me.

So if you quit Keyboard Maestro and Keyboard Maestro Engine, and then trash the file, and then launch Keyboard Maestro, is the file created? And if you then change a variable in the Preferences, Variables pane, does that stick across relaunching Keyboard Maestro?