Is it easily doable to create an action (script or otherwise) to auto-align all open windows?


Looking to create some extra window resize actions with KM. I've got them all covered except one that would be nice if possible. Often times I have 2/3 instances of Google Chrome open, and maybe 1 instance of a PDF on preview. I'll be reading a graduate textbook on Preview while referencing meticulous details on the web. It's a dreadful situation. Nonetheless, instead of manually resizing the windows to be able to see all at the same time, I was hoping there would be a way to 'auto-align' the visible windows. For example if i have 4 instances of Google Chrome open, that's an easy one because each browser/window would take up an equal 1/4 square of the monitor. If maybe there were 3 windows visible (regardless of the apps they're coming from -- it'd do maybe two of them split to quadrants on the right side of the monitor and the last window taking up the left half.

It'd be incredibly useful. The part I'm struggling with of course is the 'auto-align' part. I'm not sure there's a way to take the # visible windows and divide total window space equally between them?

Sure there is. See WINDOW function and the other window/screen functions/tokens on that page.

I gave you the reference to the KM tools you need to build this above.
But then, I got curious myself, and developed this macro as a proof-of-concept.

It is hard coded for Chrome and Preview. A more general macro would get the apps on the frontmost screen, and ask the user which windows of those apps he/she wants to "auto-align" on the screen.

But this shows the basic method, which everyone can use as a guide/reference. I have not attempted to optimize it in any way, but it seems to work fast enough.

As always, everyone should feel free to post your comments, questions, issues, and suggestions about this macro.

MACRO:   Resize All Apps on Screen to Fit Width [Example]

<a class="attachment" href="/uploads/default/original/3X/1/6/16289f2b87a7d466403b7d34a46bae07945735b4.kmmacros">Resize All Apps on Screen to Fit Width [Example].kmmacros</a> (15 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**


### ReleaseNotes



* **Show How to Tile Windows of Selected Apps to Fit Screen**

**NOTICE: This macro/script is just an _Example_**

* It has had very limited testing.
* You need to test further before using in a production environment.
* It does not have extensive error checking/handling.
* It may not be complete.  It is provided as an example to show you one approach to solving a problem.

**How To Use**

1. Select a Window in the App on the Screen of Interest
2. Trigger this macro.


* **Carefully review the Release Notes and the Macro Actions**
  * Make sure you understand what the Macro will do.  
  * You are responsible for running the Macro, not me.  ??
1. Assign a Trigger to this maro..
2. Move this macro to a Macro Group that is only Active when you need this Macro.
3. ENABLE this Macro.
4. Change the Apps you want to Tile

TAGS: @Windows @Screen @Tile