Jump to content
Macro Express Forums

Change Window Size


Recommended Posts

Yes, it certainly can be done.  Presumably you would use one macro to save the initial size and re-size the window; and a second macro to restore the initial size. 

 

Command VARIABLE SET INTEGER can be used to load the original location and dimensions of the window into variables.  Commands WINDOW RESIZE and/or WINDOW REPOSITION and/or WINDOW MOVE AND SIZE can change the location and dimensions.  All pretty straightforward. 

 

The hardest part probably is storing the integer values somewhere so they can be retrieved when it is time to reset the window location and size to the original.  Because it's simple and straightforward, I prefer writing the values to a temporary .txt file, and then reading the file when it's time to reset the window.  There are other places to store the values, such as environment variables or the registry.

Link to comment
Share on other sites

Hi Stephen,

 

Maybe start with this three-line macro, which shrinks the current window by a set amount: the window will be 50% less wide, and 60% less high.

 

You can change the values to suit your needs. The key point is that negative values decrease the size of the window, and positive values increase it.

 

If the macro works, then make a second macro that uses positive numbers. Use one macro to shrink the window, and the second macro to enlarge the window.

 

These two macros may not be exactly what you're looking for, but hopefully, the solution will be good enough. If you're new to macro scripting, rberq's more versatile solution might be a lot to take on.

 

Variable Set Integer %WidthPercent% to -50 // Shrink or enlarge the window width by this percentage
Variable Set Integer %HeightPercent% to -60 // Shrink or enlarge the window height by this percentage
 
Window Resize: <Current Window> Enlarge/Decrease by %WidthPercent% percent, %HeightPercent% percent

  
<VARIABLE SET INTEGER Option="\x00" Destination="%WidthPercent%" Value="-50" _COMMENT="Shrink or enlarge the window width by this percentage"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%HeightPercent%" Value="-60" _COMMENT="Shrink or enlarge the window height by this percentage"/>
<COMMENT/>
<WINDOW RESIZE Option="\x00" Partial="TRUE" Wildcards="FALSE" Method="\x02" Width="%WidthPercent%" Height="%HeightPercent%" _IGNORE="0x0006"/>

 

Link to comment
Share on other sites

  • 2 weeks later...

acantor, please excuse my total lack of knowledge:

 

I tried to enter the script in the script editor, one line at a time. When going to save, I got several requests regarding creating variables, which I answered yes to.

Based on the fact that the macro didn't run, I assume that this wasn't the right way to go about it.

 

Any further help would be appreciated.

 

Thanks,

Stephen

Link to comment
Share on other sites

Thanks so much acantor.

 

I've added the lines exactly as you've shown them, but I seem to need to do something additional.

After I save the macro and then re-open it, I see that the script editor has prefixed the third statement with "Text Type (Simulated Keystrokes)." If I delete this added language, it re-inserts it again after I close the editing window and re-open it.

 

I'm using Ctrl F for the activation.

 

The way that the macro currently stands, it scrolls the page when I enter the activation keys.

 

Link to comment
Share on other sites

It sounds like the problem may be the method you entered the third line of code. Try doing it this way:

 

0. Delete third line from your script.

1. From the list of categories on the left side of the screen, choose "Windows/Programs"

2. From the group, choose "Window Resize." This should cause the "Window Resize" window to appear.

3. In the Window Resize window, double check that "Use the current window" is selected.

4. Type in the two variable names for width and height, as indicated.

 

Save your macro, open a window you want to resize, and press Ctrl + F.

 

image.png.302c41af620489b7d6558763fdc72fb8.png

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...
×
×
  • Create New...