Jump to content
Macro Express Forums

How do you capture window state (e.g. min/max'd)?


Drewster
 Share

Recommended Posts

I want to move a window to the bottom left if it's not in the right place AND if it's not minimized.

 

1- What's the best way to check if it's in the bottom-left position? I am checking to see if it's on the left.

 

2- What's the best way to tell the state (minimimized, maximized, normal) of a window? I want the macro to trigger if it's not minimized. Currently my macro triggers if it's the active window. If two programs are running, one is the program I want to resize, and I close the other then the macro runs even if it's minimized.

 

Here's my macro:

 

Variable Set Integer N2 from Left of Window

If N2 <>0

If Window <mytitle> is on top

Window Reposition current window to Bottom Left

End If

End If

 

Thank you for any help you can provide. I seached the KB at macros.com but came up empty.

 

-Drew

Link to comment
Share on other sites

  • 2 weeks later...
What's the best way to check if it's in the bottom-left position? I am checking to see if it's on the left.

 

The Variable Set Integer %N2% from Left of Window command finds the position of the left side of the window. The Variable Set Integer %N3% from Top of Window finds the position of the top of the window. Based on your screen dimensions and knowing what the size of the window should be, you can determine if the window is in the lower left hand corner. Use the Variable Modify Integer command to do the math.

 

What's the best way to tell the state (minimimized, maximized, normal) of a window? I want the macro to trigger if it's not minimized. Currently my macro triggers if it's the active window. If two programs are running, one is the program I want to resize, and I close the other then the macro runs even if it's minimized.

 

If there are no other windows displayed on the screen you can try using the following two commands:

 

Variable Set Integer %N1% from Width of Window and Variable Set Integer %N2% from Height of Window

 

These will give you the dimensions of the current window. You can tell if the window is maximized or standard size based on the dimensions by using the If Variable command.

 

A minimized window provided odd values. But it seemed to provide the same values every time for each window I tested. The odd values should let you know if the window is minimized. You willl need to experiment with the window you are using to see what values are saved when minimized.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...