I found this great example by Lexikos and I wanted to integrate it into an existing script that I have already made. However, I am having trouble setting differing GUI colors properly for each window. Here is where I am stuck.
Code: Select all
MaxColorValue:=(255) ;MaxColorValue
R:=(16) ;Red
G:=(8) ;Green
B:=(0) ;Blue
SetPrimaryColor:=R
Value:=(50)
ValueSet:= ((MaxColorValue//Value)+1)
SetFormat, IntegerFast, HEX
;Example of multiple GUIs:
Loop, %ValueSet%
{ n := FreeGuiNumber() ; or in simple cases: n += 1
Subtract:=(Value * %n%)
One := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, %n%: -Caption +AlwaysOnTop +ToolWindow
;Gui, %n%:Color, Red
Gui, %n%: Color, %One%
Gui, %n%:Show, % NoActivate "X"(A_ScreenWidth//4)+A_Index*50 "Y"(A_ScreenHeight//4) "W"50 "H"525, `#%n%
} Return
;https://autohotkey.com/board/topic/54978-multiple-dynamic-gui-window-of-parents/
FreeGuiNumber()
{ SetFormat, IntegerFast, Dec
Gui %A_Index%:+LastFoundExist
IfWinNotExist
Return A_Index
} Return
How can I set the colors in each of the Gui's, so that they all appear as the child GUI's from the example below?
Code: Select all
Gui, Main: -AlwaysOnTop -Caption +LastFound ;+E0x20 Makes GUI click through
Main_ID := WinExist()
Gui, Main: Color, Black
Gui, Main: Show, w710 h535, Parent
MaxColorValue:=(255) ;MaxColorValue
R:=(16) ;Red
G:=(8) ;Green
B:=(0) ;Blue
SetPrimaryColor:=R
Value:= 60
SetFormat, IntegerFast, HEX
Subtract:=(Value * 0)
One := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 1: Color, %One%
Gui, 1: -Caption +LastFound +E0x00010000 ;The ExStyle allows the parent to take focus if it's clicked.
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 1: Show, x5 y5 w50 h525, Child #1
Subtract:= (Value * 1)
Two := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 2: Color, %Two%
Gui, 2: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 2: Show, x55 y5 w50 h525, Child #2
Subtract:= (Value * 2)
Three := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 3: Color, %three%
Gui, 3: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 3: Show, x105 y5 w50 h525, Child #3
Subtract:= (Value * 3)
Four := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 4: Color, %Four%
Gui, 4: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 4: Show, x155 y5 w50 h525, Child #4
Subtract:= (Value * 4)
Five := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 5: Color, %Five%
Gui, 5: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 5: Show, x205 y5 w50 h525, Child #5
Subtract:= (Value * 5)
Six := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 6: Color, %Six%
Gui, 6: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 6: Show, x255 y5 w50 h525, Child #6
Subtract:= (Value * 6)
Seven := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 7: Color, %Seven%
Gui, 7: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 7: Show, x305 y5 w50 h525, Child #7
Subtract:= (Value * 7)
Eight := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 8: Color, %Eight%
Gui, 8: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 8: Show, x355 y5 w50 h525, Child #8
Subtract:= (Value * 8)
Nine := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 9: Color, %Nine%
Gui, 9: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 9: Show, x405 y5 w50 h525, Child #9
Subtract:= (Value * 9)
Ten := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 10: Color, %Ten%
Gui, 10: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 10: Show, x455 y5 w50 h525, Child #10
Subtract:= (Value * 10)
Eleven := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 11: Color, %Eleven%
Gui, 11: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 11: Show, x505 y5 w50 h525, Child #11
Subtract:= (Value * 11)
Twelve := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 12: Color, %Twelve%
Gui, 12: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 12: Show, x555 y5 w50 h525, Child #12
Subtract:= (Value * 12)
Thirteen := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 13: Color, %Thirteen%
Gui, 13: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 13: Show, x605 y5 w50 h525, Child #13
Subtract:= (Value * 13)
Fourteen := (MaxColorValue-Subtract<<SetPrimaryColor)
Gui, 14: Color, %Fourteen%
Gui, 14: -Caption +LastFound +E0x00010000
DllCall("SetParent", "uint", WinExist(), "uint", Main_ID)
Gui, 14: Show, x655 y5 w50 h525, Child #14
Return