Show current window dimensions

Keyboard Maestro “Display Text” Action

Since I am a keyboard cowboy, and I move my windows around using hot keys, here's a quickie - demonstrating the ease of use of KM - showing the current app, window name, and dimensions in KM format.

Display Text.kmactions (1.2 KB)

Hey Carey,

You'll probably want to note this thread then.

Also this:

http://flipmartin.net/software/tips-and-tricks-for-keyboard-maestro

Search for: 'Get Cursor Position'

I think Philippe's was first.

-Chris

I found the second one very helpful, but is there any way to bypass creating the intermediate variable?

For example: Can I address the ‘Width’ component of this directly?

%ScreenVisible%Front%

I’m looking for something like this %ScreenVisible%Front.Left%

Perhaps I should elaborate: I’m looking to perform a switch comparing the current window frame (%WindowFrame%1%) to a percentage of the current screen size.

Example Array:

ScreenVisible(Front,Left)*10%, ScreenVisible(Front,Top), ScreenVisible(Front,Width)*80%, ScreenVisible(Front,Height)

Does that make sense?

Hey Carey,

Scope out the Screen & Window Functions:

https://wiki.keyboardmaestro.com/function/SCREEN
https://wiki.keyboardmaestro.com/function/WINDOW

%Calculate% SCREEN(Main, Bottom) * 0.8 %

-Chris

Doh!!! I keep forgetting that there are complimentary tokens and functions.

Never mind…

Looks like this works in a ‘set variable to calculation’ window, but in a ‘set variable to text’ %Calculation% it’s not happy:

SCREENVISIBLE(Front,Left,20%),SCREENVISIBLE(Front,Top),SCREENVISIBLE(Front,Width)*60%,SCREENVISIBLE(Front,Height)

I need the array to do the comparison in the switch statement.

Hey Carey,

You're missing the fact that the calculation token uses the percent sign as a delimiter, so your use of '%' within the calculation causes problems.

%Calculate%SCREENVISIBLE(Front,Right)*20/100%

I don't know if there's a way to escape the '%' character, so the calculation sees it in context – Peter will have to weigh-in on that.

-Chris

Nope. Within a %Calculate% you cannot use a percent sign.

Ahhh…