Link to home
Start Free TrialLog in
Avatar of WeThotUWasAToad
WeThotUWasAToad

asked on

Display graphic over any content on the screen

Hello,

What's the best/easiest way to create a diagram or template which will overlie any content on the screen?

For example, suppose you create some type of diagram using PowerPoint as shown here:

User generated image
Is there a way to save the diagram as some kind of image file which can then be displayed (outside of PowerPoint or any other application) to overlie (ie be always-on-top) whatever apps/windows may be active or displayed on the screen — such as the EE website:

User generated image
Thanks
Avatar of ☠ MASQ ☠
☠ MASQ ☠

No.

Firstly any image will need to be displayed within an application otherwise they are just a binary data file.

The issue with an image universally remaining in front of any application is that most Windows apps that display content by design are programmed to open in-front of other apps that are already running.  This is called "focus" and is how Windows manages the current window.

That doesn't mean it wouldn't be possible to force the window to appear in front of some applications but your requirement seems to be that the image displayed needs to be transparent and allow the window behind to be visible through the image. which is also outside of the fundamental way Windows functions.

You may have seen webpages where an overlay like you describe is present and that is possible but won't stop another winow opening in front of it.

Those overlays on the web are part of the code on the website though not on the local computer.
You can do that with a script, sure. What exactly do you want displayed though and at what precise locations?

Edit: I have made a script you can test out. You can move the objects around.

If it is what you want, let me know if you want the code and you can modify the shapes/size/positions and transparency you want or tell me what you want and I'll do it if it's within my ability.

Remove the .pdf extension and run it. Press CTRL+1 to show your overlay objects. CTRL+2 to hide your objects and CTRL+3 to close the app.
Overlay_Objects.exe.pdf
I'm guessing you are on windows.
If so you want a photo to everlay desktop and any other app launching on windows.

Unless you get more specific and narrow your request, this would be very tough!

You will need to modify windows core functionality.

So I suggest you explain more on what exactly you want to acheev.
Never too proud to say I'm wrong - Nicely done ZeropointNRG - is that a single line of code in AHK??
Pretty much.

OnMessage(0x201, "WM_LBUTTONDOWN")
^1::
Shape1:
Gui 1:+LastFound
Gui 1:+ToolWindow -Caption +AlwaysOnTop
Gui 1:Show, H300 W300 X1700 Y250 ; Viewport + position of shape.
Gui 1:color, 000000
WinSet, TransColor, 100000 255 ; 0 - 255, set it to 255 for no transparency.
WinSet, Region, 0-0 H300 W300

Shape2:
Gui 2:+LastFound
Gui 2:+ToolWindow -Caption +AlwaysOnTop
Gui 2:color, 0000FF
Gui 2:Show, H300 W300 X2005 Y250
WinSet, TransColor, 200000 150
WinSet, Region, 50-0 250-0 150-250

Shape3:
Gui 3:+LastFound
Gui 3:+ToolWindow -Caption +AlwaysOnTop
Gui 3:color, FF0000
Gui 3:Show, H300 W300 X2310 Y250
WinSet, TransColor, 300000 150
WinSet, Region, 0-0 H300 W300 R300-300 ; size of shape + rounded edges.

Shape4:
Gui 4:+LastFound
Gui 4:+ToolWindow -Caption +AlwaysOnTop
Gui 4:color, 00FF00
Gui 4:Show, H300 W300 X2615 Y250
WinSet, TransColor, 400000 150 ;                         
WinSet, Region, 0-0 300-0 300-300 0-300 0-0  100-100 200-100 200-200 100-200 100-100


;============================================
WM_LBUTTONDOWN()
{
	PostMessage, 0xA1, 2
}
return

^2::reload
^3::ExitApp

Open in new window

Avatar of WeThotUWasAToad

ASKER

Thanks for the comments.

This is awesome ZeropointNRG! Thank you. Once again, AutoHotkey saves the day.

I understand the GUI features (ie +LastFound, +ToolWindow, -Caption, +AlwaysOnTop, Color, Show) and WinSet, but can you explain "WM_LBUTTONDOWN", what it does, and how/why it is used for each shape:

OnMessage(0x201, "WM_LBUTTONDOWN")

Open in new window

...as well as at the end of the script:

WM_LBUTTONDOWN()
{
	PostMessage, 0xA1, 2
}
return

Open in new window

Also, I'm puzzled by why there are two Return commands, one after the end of Shape4, and the other after the PostMessage... block shown above.

Thanks
Oh, and one more thing:

Is there a simple way to script for a box with only a border and no fill, or must that be done using WinSet and defining the interior transparent portion as just barely inside (less than) the object dimensions?
I just copied and pasted the code down from an old script I had, you can remove them and the return and just leave one "OnMessage." and the "return" after it. Yeah you just want a border? Haven't tried that, I'm sure you can do it easily.
Oh, OnMessage allows you to grab the gui..And you don't need it for all of them they're just copy paste and I forgot to remove them lol.
Actually, I guess I don't clearly understand: WinSet, TransColor.

The code you have for that component of each shape is respectively:

WinSet, TransColor, 100000 150
WinSet, TransColor, 200000 150
WinSet, TransColor, 300000 150
WinSet, TransColor, 400000 150

I understand the final value of 150 for each shape defines transparency and can be any value between 0 & 255. However,
I don't understand the preceding 6 digit value — in which the first digit increases by one for each shape.

The docs for TransColor contains the following statement and syntax:
TransColor
Makes all pixels of the chosen color invisible inside the target window.
WinSet, TransColor, Color [, WinTitle, WinText, ExcludeTitle, ExcludeText]
So I presume the 6-digit value is a hex color code but the first digit in each case, seems to be corresponding to the Shape number rather than a color.
I added +resize, which adds it's own border to grab and resize. Let me tinker a bit more.
Those numbers are just a hack, you can ignore those, they can be anything you like, gui:color overrides that anyway, but without the numbers there all of the shapes will be the same color. I just needed it so you could have different colored shapes in the same script with transparency. I didn't tinker enough to find another way. I'm sure there is though. But it worked so, I left it lol xD
Nah, I don't know. I've gone off course. Did you want colored shapes to be in a static area? Or you only want this box?

You can't drag the shape around to place it if we set transcolor to the color we want to make transparent (the inside,) so you have to add the title bar to move it around, which is ugly. Even then it goes transparent too.

So I'm guessing winset region if you still want them colored.
I've found a way, but I need to know exactly what you want first.

Do you want multiple colored boxes? Resizable? Movable? Different shapes? All in the same script?
LOL. Yeah, all of the above if they are on the menu!

No, seriously, it would be amazing if they could be movable and resizable — and someone on the AutoHotkey forum actually posted a script which makes objects movable* — but it is a script that is way over my head and the script you posted above seems much simpler and is a great solution for what I'm after.

In other words, I definitely want/need the ability to change screen positions and box sizes but I would be perfectly content if I could change origins and dimensions of each box by simply modifying x, y, w, h parameters in the script then refreshing (reloading) it.

To be honest, I was initially looking for a solution to this line of inquiry on the AutoHotkey forum* and for the very reason mentioned above, I decided to jump over and post a question here (EE) on the chance that some other (simpler) method might get me there. So that's why I was surprised but delighted when you posted an AHK solution.

I'm still a bit foggy about how to create non-rectangular objects but that's more for curiosity than it is for my current objective. For the latter, I'm just after the simplest solution to create multiple boxes (rectangles) with different colors and know how to adjust their positions and sizes by modifications in the script.

By the way, yes, I would prefer to have all of the objects come from a single script (such as your Shape1, Shape2, ...etc solution above).

Thanks again

*Here are the AutoHotkey threads in case you are interested. (Yikes, there are more than I realized.)

Simple GUI box to overlie image on screen
Change initial screen position of GUI
Include multiple GUIs with hotkeys in a single script
GUI, Show vs WinSet, Region dimension parameters
Create irregular polygon GUI
By the way, could you post a cleaned-up version of your 4-shape GUI script? I'm still a bit confused on just which parts you said are redundant or can be eliminated. Thanks
I've adapted another script.

Upon starting the script, the 3 guis will open in a resizable state but stacked ontop of eachother. Grab the title bar to move them to show each.

Move them to where you want them, resize to your liking, then press the corresponding hotkey matching the Box number. So for Box 1, you'd press CTRL+1, etc. (I've added a title to each gui named Box 1 - 3 to make it easier to remember what hotkey to press.)

After pressing the corresponding hotkey, the borders will appear, which are also movable, but you cannot resize them. To resize them, press the corresponding hotkey again and resize,  again press the hotkey to show the border.

Try it;

a:=10 ; Box 1's border thickness in px.
b:=10 ; Box 2's border thickness in px.
c:=10 ; Box 3's border thickness in px.
d:=10 ; etc, etc
e:=10
f:=10
g:=10
;========================================
e=false
OnMessage(0x201, "WM_LBUTTONDOWN")
;======================================== BOX 1
Gui 1: +LastFound
Gui 1: +ToolWindow +Caption +AlwaysOnTop +Resize
Gui 1: color, 000000
WinSet, TransColor, 000000 150
WinSet, Region, 0-0 H30000 W30000 0-0
Gui 1: Show, w250 h250, BOX 1
;======================================== BOX 2
Gui 2: +LastFound
Gui 2: +ToolWindow +Caption +AlwaysOnTop +Resize
Gui 2: color, 000000
WinSet, TransColor, 000000 150
WinSet, Region, 0-0 H30000 W30000 0-0
Gui 2: Show, w250 h250, BOX 2
;======================================== BOX 3
Gui 3: +LastFound
Gui 3: +ToolWindow +Caption +AlwaysOnTop +Resize
Gui 3: color, 000000
WinSet, TransColor, 000000 150
WinSet, Region, 0-0 H30000 W30000 0-0
Gui 3: Show, w250 h250, BOX 3
return
;======================================== BOX 4






;======================================== BOX 5






;======================================== Box 1
^1:: ;CTRL+1 hotkey          
	e:=!e							; E is false by default, changes to true upon first CTRL+1, 2, 3, 4 push, etc. 
	if e {							; Makes the "border" immovable.
		Gui 1: +LastFound				; Makes GUI the same background color as your regular window GUI apps
		Gui 1: -Caption +ToolWindow -Resize +AlwaysOnTop ; "ToolWindow: Provides a narrower title bar but the window will have no taskbar button" -Caption "removes border and title bar",       
		Gui 1: Color, 0000FF				; Blue Border Color in RGB
		WinGetPos,,,w,h
		q:=w-a, z:=h-a                                                                         ; Precalculates border
		WinSet, Region, 0-0 %w%-0 %w%-%h% 0-%h% 0-0  %a%-%a% %q%-%a% %q%-%z% %a%-%z% %a%-%a%   ; Creates "border"
	}
	else {
		Gui 1:+LastFound
		Gui 1:+ToolWindow +Caption +AlwaysOnTop +Resize
		Gui 1:color, 000000
		WinSet, TransColor, 000000 150
		WinSet, Region, 0-0 H30000 W30000 0-0
	}
return
;======================================== Box 2
^2:: ;CTRL+2 hotkey
	e:=!e
	if e {
		Gui 2: +LastFound
		Gui 2: -Caption +ToolWindow -Resize +AlwaysOnTop
		Gui 2: Color, 00FF00 ; Green Border Color in RGB
		WinGetPos,,,w,h
		q:=w-b, z:=h-b                           											 ; Replace every "b" in this line with "c" in Box 3.
		WinSet, Region, 0-0 %w%-0 %w%-%h% 0-%h% 0-0  %b%-%b% %q%-%b% %q%-%z% %b%-%z% %b%-%b% ; Replace every "b" in this line with "c" in Box 3.
	}
	else { 
		Gui 2:+LastFound
		Gui 2:+ToolWindow +Caption +AlwaysOnTop +Resize
		Gui 2:color, 000000
		WinSet, TransColor, 000000 150
		WinSet, Region, 0-0 H30000 W30000 0-0
		}
return
;======================================== Box 3
^3:: ;CTRL+3 hotkey
	e:=!e                                                            
	if e {                                                          
		Gui 3: +LastFound
		Gui 3: -Caption +ToolWindow -Resize +AlwaysOnTop
		Gui 3: Color, FF0000    ; Red Border Color in RGB                                       
		WinGetPos,,,w,h
		q:=w-c, z:=h-c                                                                       ; Replace every "c" in this line with "d" in Box 4.
		WinSet, Region, 0-0 %w%-0 %w%-%h% 0-%h% 0-0  %c%-%c% %q%-%b% %q%-%z% %c%-%z% %c%-%c% ; Replace every "c" in this line with "d" in Box 4.
	}
	else {                                                           
		Gui 3:+LastFound
		Gui 3:+ToolWindow +Caption +AlwaysOnTop +Resize
		Gui 3:color, 000000
		WinSet, TransColor, 000000 150
		WinSet, Region, 0-0 H30000 W30000 0-0
	}
return
;======================================== Box 4
; Just duplicate any of the Box's from 1 - 3 and change the values to match.






;======================================== Box 5







;======================================== Etc
WM_LBUTTONDOWN()
{
	PostMessage, 0xA1, 2
}
return

^5::reload  ; Change this to another number CTRL+ w/e if you add more than 4 objects.
^6::ExitApp ; Change this to another number CTRL+ w/e if you add more than 5 objects.

Open in new window

The below script is for your image overlay.
F1::
; Create a transparent picture in Photoshop.    
; Set the resolution to your monitors resolution.
; Place your objects and make the items you want transparent on the canvas and save with transparency.
; Place your .png into the script folder and rename "zero.jpg" below with your pictures file name.
; Save the script.
Gui img: Add, Picture, x0 y0 ,zero.jpg 
Gui img: +LastFound
Gui img: -ToolWindow -Caption +AlwaysOnTop -Resize +E0x20  ; +E0x20 allows you to click through your image to interact with the background. Remove it if you don't want that.
Gui img: Show, w1920 h1080, BOX 10	; Set the w and h to your monitors resolution. Make sure your picture made in Photoshop is the same resolution.
;Gui img: color, 000000 ; Uncomment this if you want the whole picture transparent.
;WinSet, TransColor, 000000 150 ; Uncomment this if you want the whole picture transparent.
return
F2::reload
F3::ExitApp

Open in new window

I already edited my original post.
Hey ZeropointNRG,

This just keeps getting better! Thanks

The three stacked boxes appear as soon as I run the script and I can indeed easily
drag to position them one-at-a-time and easily drag corners or sides to resize them.

However, I'm not understanding what occurs by pressing the corresponding hotkeys.

In your post you said:
After pressing the corresponding hotkey, the borders will appear, which are also movable, but you cannot resize them. To resize them, press the corresponding hotkey again and resize, again press the hotkey to show the border.
However, I must be doing something wrong because after repositioning and resizing a box, pressing the hotkey for that box does not seem to change anything in its position, appearance, resize-ability, etc.

Some questions:

How do I eliminate the "Box #" bar at the top of each GUI if desired and will doing so eliminate the ability to drag the box?

Also, would it be difficult to add code which, after a particular GUI has been repositioned and resized, displays it's new parameters? This way, it would be a quick process to change the GUI's initial position and size in the script so that it does not have to be modified each time it is opened.

In other words, I'm thinking of something similar to:
WinGetActiveStats, `Title, Width, Height, X, Y
MsgBox The window position is: %X%, %Y%, %Width%, %Height%

Open in new window


By the way, I use the following hotkeys so there's no conflict with GUI number:

!Esc::Reload
^Esc::ExitApp

Many thanks!
You have to press the hotkey twice.

1.) When you start the script, 3 boxes will open stacked ontop of eachother. Move them and resize them.
2.) Cycle through the hotkeys of the corresponding BOX # you want to adjust. you may have to press the hotkey a couple of times each time to interact with the borders showing..

After pressing the corresponding hotkey, the borders will appear, which are also movable, but you cannot resize them. To resize them, press the corresponding hotkey again and resize, again press the hotkey to show the border.

Like the Shape script, the borders with -Caption are movable. They are movable in both states. But you cannot resize them in the border state after pressing the hotkey, you can only reposition them.

If you want to resize them, you need to press the hotkey again to make them resizable, then press them again to show the fancy border colors..

If the borders won't show, press the hotkeys more than once to cycle the if-else statement..

How do I eliminate the "Box #" bar at the top of each GUI if desired
The effect after pressing the hotkeys will remove that. That is only the resize state. If you want them gone we have to change "+Caption" to "-Caption" in the Gui at the top, but then because transcolor is set, you can't move them in this state, so we have to do that transcolor hack by not making the transcolor match the gui: color.

So it looks like this
Gui 1: color, 000000
WinSet, TransColor, 100000 100

Open in new window

And the else statement's would look like this;
	else {
		Gui 1:+LastFound
		Gui 1:+ToolWindow -Caption +AlwaysOnTop +Resize
		Gui 1:color, 000000
		WinSet, TransColor, 100000 100
		WinSet, Region, 0-0 H30000 W30000 0-0
	}

Open in new window


I added this title bar with Box 1, 2, 3 etc so it would be easier for you to know which hotkey each window belongs to instead of cycling through them all as you added more boxes.


Also, would it be difficult to add code which, after a particular GUI has been repositioned and resized, displays it's new parameters? This way, it would be a quick process to change the GUI's initial position and size in the script so that it does not have to be modified each time it is opened.

In other words, I'm thinking of something similar to:

You can already change it's initial position in both states easily. And basically you want this to remember your positions for each object when the script is closed? I don't know how to do that without spending more time on this.

A workaround would be to use the Window Spy by right clicking the ahk icon > Window Spy, checking it's position then add the static position to the gui for each box (Gui 1:Show, H300 W300 X1700 Y250) once you've worked out what goes where then you'd update the h,w,x,y positions.

I also added the image_overlay script for this reason, but you have to make the images yourself in photoshop.
You have to press the hotkey twice.
Oh wow! I had no idea that's what you were doing. This is really super!

Now that I see how they work, there's obviously no need to remove the "Box #" bar since it vanishes when I press the hotkey.
I don't know how to do that without spending more time on this.
No, definitely no need to spend more time. This is already great just how you've got it. I really appreciate it as it will be very very useful.

The only remaining issue is that I attempted to add a 4th box but it failed to display when I ran the script. I thought I was careful in updating everything as needed but I obviously missed something. Can you take a look here and see if you can spot my error?

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir C:\Users\Steve\sb_FOLDERS-BY-TAG (Win10)\ca_AHK  ; Ensures a consistent starting directory.
#SingleInstance, Force

a:=10 ; Box 1's border thickness in px.
b:=10 ; Box 2's border thickness in px.
c:=10 ; Box 3's border thickness in px.
d:=10 ; etc, etc
e:=10
f:=10
g:=10
;========================================
e=false
OnMessage(0x201, "WM_LBUTTONDOWN")
;======================================== BOX 1
Gui 1: +LastFound
Gui 1: +ToolWindow +Caption +AlwaysOnTop +Resize
Gui 1: color, 000000
WinSet, TransColor, 000000 150
WinSet, Region, 0-0 H30000 W30000 0-0
Gui 1: Show, w250 h250, BOX 1
;======================================== BOX 2
Gui 2: +LastFound
Gui 2: +ToolWindow +Caption +AlwaysOnTop +Resize
Gui 2: color, 000000
WinSet, TransColor, 000000 150
WinSet, Region, 0-0 H30000 W30000 0-0
Gui 2: Show, w250 h250, BOX 2
;======================================== BOX 3
Gui 3: +LastFound
Gui 3: +ToolWindow +Caption +AlwaysOnTop +Resize
Gui 3: color, 000000
WinSet, TransColor, 000000 150
WinSet, Region, 0-0 H30000 W30000 0-0
Gui 3: Show, w250 h250, BOX 3
return
;======================================== BOX 4
Gui 4: +LastFound
Gui 4: +ToolWindow +Caption +AlwaysOnTop +Resize
Gui 4: color, 000000
WinSet, TransColor, 000000 150
WinSet, Region, 0-0 H30000 W30000 0-0
Gui 4: Show, w250 h250, BOX 4
return
;======================================== BOX 5






;======================================== Box 1
^1:: ;CTRL+1 hotkey          
	e:=!e							; E is false by default, changes to true upon first CTRL+1, 2, 3, 4 push, etc. 
	if e {							; Makes the "border" immovable.
		Gui 1: +LastFound				; Makes GUI the same background color as your regular window GUI apps
		Gui 1: -Caption +ToolWindow -Resize +AlwaysOnTop ; "ToolWindow: Provides a narrower title bar but the window will have no taskbar button" -Caption "removes border and title bar",       
		Gui 1: Color, 0000FF				; Blue Border Color in RGB
		WinGetPos,,,w,h
		q:=w-a, z:=h-a                                                                         ; Precalculates border
		WinSet, Region, 0-0 %w%-0 %w%-%h% 0-%h% 0-0  %a%-%a% %q%-%a% %q%-%z% %a%-%z% %a%-%a%   ; Creates "border"
	}
	else {
		Gui 1:+LastFound
		Gui 1:+ToolWindow +Caption +AlwaysOnTop +Resize
		Gui 1:color, 000000
		WinSet, TransColor, 000000 150
		WinSet, Region, 0-0 H30000 W30000 0-0
	}
return
;======================================== Box 2
^2:: ;CTRL+2 hotkey
	e:=!e
	if e {
		Gui 2: +LastFound
		Gui 2: -Caption +ToolWindow -Resize +AlwaysOnTop
		Gui 2: Color, 00FF00 ; Green Border Color in RGB
		WinGetPos,,,w,h
		q:=w-b, z:=h-b                           											 ; Replace every "b" in this line with "c" in Box 3.
		WinSet, Region, 0-0 %w%-0 %w%-%h% 0-%h% 0-0  %b%-%b% %q%-%b% %q%-%z% %b%-%z% %b%-%b% ; Replace every "b" in this line with "c" in Box 3.
	}
	else { 
		Gui 2:+LastFound
		Gui 2:+ToolWindow +Caption +AlwaysOnTop +Resize
		Gui 2:color, 000000
		WinSet, TransColor, 000000 150
		WinSet, Region, 0-0 H30000 W30000 0-0
		}
return
;======================================== Box 3
^3:: ;CTRL+3 hotkey
	e:=!e                                                            
	if e {                                                          
		Gui 3: +LastFound
		Gui 3: -Caption +ToolWindow -Resize +AlwaysOnTop
		Gui 3: Color, FF0000    ; Red Border Color in RGB                                       
		WinGetPos,,,w,h
		q:=w-c, z:=h-c                                                                       ; Replace every "c" in this line with "d" in Box 4.
		WinSet, Region, 0-0 %w%-0 %w%-%h% 0-%h% 0-0  %c%-%c% %q%-%b% %q%-%z% %c%-%z% %c%-%c% ; Replace every "c" in this line with "d" in Box 4.
	}
	else {                                                           
		Gui 3:+LastFound
		Gui 3:+ToolWindow +Caption +AlwaysOnTop +Resize
		Gui 3:color, 000000
		WinSet, TransColor, 000000 150
		WinSet, Region, 0-0 H30000 W30000 0-0
	}
return
;======================================== Box 4
^4:: ;CTRL+4 hotkey
	e:=!e                                                            
	if e {                                                          
		Gui 4: +LastFound
		Gui 4: -Caption +ToolWindow -Resize +AlwaysOnTop
		Gui 4: Color, FF00FF    ; Red Border Color in RGB                                       
		WinGetPos,,,w,h
		q:=w-d, z:=h-d                                                                       ; Replace every "d" in this line with "e" in Box 5.
		WinSet, Region, 0-0 %w%-0 %w%-%h% 0-%h% 0-0  %d%-%d% %q%-%b% %q%-%z% %d%-%z% %d%-%d% ; Replace every "d" in this line with "e" in Box 5.
	}
	else {                                                           
		Gui 4:+LastFound
		Gui 4:+ToolWindow +Caption +AlwaysOnTop +Resize
		Gui 4:color, 000000
		WinSet, TransColor, 000000 150
		WinSet, Region, 0-0 H30000 W30000 0-0
	}
return
;======================================== Box 5







;======================================== Etc
WM_LBUTTONDOWN()
{
	PostMessage, 0xA1, 2
}
return

!Esc::Reload
^Esc::ExitApp

Open in new window

By the way, do you post on the AutoHotkey forum (if so, what username?) and do you mind if I post your solution script there? I'm sure there are others who would benefit from it.

Thanks again ZeropointNRG!
ASKER CERTIFIED SOLUTION
Avatar of ZeropointNRG
ZeropointNRG
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have to remove the return from GUI :3
Of course! That's quite obvious now that you point it out.

Reddit, hmm? Great. I will post it on AHK and it will probably continue making the rounds.

Thanks again for all the help. I wish I could award you EE points for about a dozen different threads because this has helped me a ton!
I had a dream about boxes last night ;/ lol...

Glad it helped!
Hi ZeropointNRG,

I'm not surprised by your dreams since you've been spending so much time on this. I hope this doesn't make them worse. :)

I believe I understand most of how the script works but I'm still not sure how to modify it exactly to my needs. I've got it working pretty well in terms of:
• adding new boxes, and
• defining colors.

However, I'm still not sure how to specify the position and size for a given box once I determine where I want it permanently. In other words, instead of all boxes opening in the center of the screen with identical dimensions (as they do now), I'd like the ability to define where each box opens as well as its dimensions (and make that a permanent part of the script.)

__________________________________________________

The remainder of this post describes what I've been doing to make the script, for me at least, easier to understand and modify. However, it may or may not be helpful in responding to the previous paragraph (which is my main objective with this post) so certainly do not feel obligated to go through it:

The first thing I did is to change some things to hopefully make the boxes more uniform so adding and modifying boxes does not confuse me so much. To do this, I created sort of a standard box template in two parts, one for the top portion of the box code and a second for the bottom portion of the box code.

This is for the top:
; For each box, replace every {number sign} with Box number

;======================================== BOX #
Gui #: +LastFound
Gui #: +ToolWindow +Caption +AlwaysOnTop +Resize
Gui #: color, 000000
WinSet, TransColor, 000000 150
WinSet, Region, 0-0 H30000 W30000 0-0
Gui #: Show, w250 h250, BOX #

Open in new window

This is for the bottom:
; For each box, replace every {number sign} with Box number and replace every {vertical bar} with corresponding Box letter (ie 1 & a, 2 & b, 3 & c, etc)		
; Also define hex color-code for each box		
		
;======================================== Box #		
^#:: ;CTRL+# hotkey		
	e:=!e	
	if e {	
		Gui #: +LastFound
		Gui #: -Caption +ToolWindow -Resize +AlwaysOnTop
		Gui #: Color, FF0000 ; Red Border Color in RGB
		WinGetPos,,,w,h
		q:=w-|, z:=h-|
		WinSet, Region, 0-0 %w%-0 %w%-%h% 0-%h% 0-0  %|%-%|% %q%-%|% %q%-%z% %|%-%z% %|%-%|%
	}	
	else { 	
		Gui #:+LastFound
		Gui #:+ToolWindow +Caption +AlwaysOnTop +Resize
		Gui #:color, 000000
		WinSet, TransColor, 000000 150
		WinSet, Region, 0-0 H30000 W30000 0-0
		}
Return

Open in new window

To do this, I used two keyboard symbols (# & |) which do not appear anywhere else in the script. Hopefully it's apparent that the templates can be used to define any new box, ie a Ctrl+h replacement can be made to change all number signs (#) to the desired box number and a second Ctrl+h replacement can be made to change all vertical bars (|) to the box number's corresponding lowercase letter.

__________________________________________________

The second thing I did was to set up a spreadsheet to easily create the code for a series of boxes. The spreadsheet file is attached in case it is helpful.

Spreadsheet notes:

Columns B:F contain:
• input variables to specify box numbers and box colors

Columns H:J contain:
• beginning (rows 7:28 in light green) and ending (rows 272:283 in light red) fixed code
• the two types of templates shown above
Note: the only (Excel) formulas in these columns are indicated in bold

Columns L:N contain:
• the final script to be pasted into the .ahk file
• the content in this section result from formulas which make the needed substitutions:
      > number signs are replaced by the box number
      > vertical bars are replaced by the corresponding letter

Thanks

Multiple-GUI-boxes-script-template-.xlsm
You're complicating this.

1.) Place your first box exactly where you want it to appear each start of the script.
2.) Right click the AHK icon in the lower right corner of the open apps, click > Window Spy.
3.) Activate the first box by clicking it in the resize state. Cycle it to make sure the borders exactly where you want.
4.) Inside the Window Spy, highlight the "X, Y, W, H" data from the "Active Window Position" output and copy/paste it somewhere.
5.) Change the Box GUI with this data like so;
Gui 1:Show, W### H### X### Y###

Open in new window

User generated image
Perfect.

Yes, I was over complicating it.

Plus, I've never used the Window Spy before so knowing about that is a big added benefit.

Many thanks!
Thanks for all the comments and assistance.
I said it in my previous post ;P

Glad you're all sorted, if you need more help, I'll be here.
Thanks for the testy bud :)
Hey ZeropointNRG,

I'm having problems getting new width & height parameters to display correctly.

Rather than extending this already-overextended thread, I opted to create a new thread. It's located here:

AutoHotkey GUI size parameters different than script

Thanks