Variables in "Move and Resize Front Window"

Newbie Question (searched the forum for all Topics Resize, Window, Variable - didn't find it, sorry)

How does it work to use variables in "Move and Resize Front Window" (or anywhere in actions)?

%Variable%DockWidth% didn't work either...

...or will that only work in gernerally only in "next Version 7"?

Thanks!

Thomas

There is nothing wrong with your macro - the problem is only that DockWidth does not currently have a numeric value. It is currently the empty string - when you run the macro, it will become 52, but Keyboard Maestro does not understand that. As soon as it becomes 52, the DockWidth will turn black in your Move & Resize Front Window action. If you click the Try button on the action, it will become 52 and then the DockWidth will turn black.

I changed version 7 so that instead of red, it displays orange where the calculation could be correct if the variable had a different value (I also added a SCREENVISIBLE function that takes in to account the menu and dock).

@peternlewis

Can this work? It does not seem to.
28%20PM

Depending on the situation, I would like to change the variable whichScreen to Main or Internal, and so would like to use the variable in "Move and Resize" action. Thank you.

When you use a calculation in the parameter, the calculation is a numeric result, and so the variable whichScreen must have a numeric value, not one of the keywords.

“Main” is the same as screen 0, so just set whichScreen to 0.

Thank you.

I have adjusted the code to allow a variable name that contains a screen name in the first field for the next version.

2 Likes