multiple GUI start in one script?
Posted: 13 Feb 2019, 23:40
multiple GUI start in one script. possible?
this shows only one GUI:
this shows only one GUI:
Gui, Show, NoActivate x+%x% y%y%,titleOrSo2
Let's help each other out
https://www.autohotkey.com/boards/
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=62024
Code: Select all
if(1){
; Get Current Position
SysGet,Mon_BboxNew_,Monitor,0
y := Mon_BboxNew_Bottom - 170
x := Mon_BboxNew_Right - 170
hwndGui1 := newGui()
Gui, %hwndGui1%:Show, NoActivate x+%x% y%y%,titleOrSo
y := Mon_BboxNew_Bottom - 270
x := Mon_BboxNew_Right - 270
hwndGui2 := newGui()
Gui, %hwndGui2%:Show, NoActivate x+%x% y%y%,titleOrSo2
}
newGui() {
Gui, New, +AlwaysOnTop +ToolWindow -SysMenu -Caption +Hwndhwnd ; <<< this here
Gui, Font, cWhite s10 q1, Arial Narrow ;red ; changed s11 to s10
str := "huibuhh huibuhh huibuhh huibuhh huibuhh huibuhh huibuhh "
Gui, Add, Text, vD y0 , %str%
return hwnd
}
Code: Select all
newGui2(200,"titleOrSo1902121943")
WinSet, AlwaysOnTop, On, titleOrSo1902121943
FormatTime, timestampHHmmss, %A_now%,HH:mm:ss
GuiControl, , D, %timestampHHmmss% %return_from_LineNumber%:%actionList% | %activeTitle%
; ^- works
newGui2(100,"title1902141119")
; ^- works not
newGui2(y , title ) {
global
; global vD, str
; Get Current Position
SysGet,Mon_BboxNew_,Monitor,0
; y := Mon_BboxNew_Bottom - 170
x := Mon_BboxNew_Right - 170
Gui, +AlwaysOnTop +ToolWindow -SysMenu -Caption
Gui, Color, green
Gui, Font, cWhite s10 q1, Arial Narrow ;red ; changed s11 to s10
str := "huibuhh huibuhh huibuhh huibuhh huibuhh huibuhh huibuhh "
Gui, Add, Text, vD y0 , %str%
; Gui, Add, Text, D y0 , %str% ; invalid option
;GuiControl, , D, %timestampHHmmss% %return_from_LineNumber%:%actionList% | %activeTitle%
Gui, Show, NoActivate x+%x% y%y%,%title% ; screen position here
; y := Mon_BboxNew_Bottom - 270
x := Mon_BboxNew_Right - 270
Gui, Show, NoActivate x+%x% y%y%,%title% ; screen position here
; WinSet, TransColor, green 255,titleOrSo ; 255 is max tansparent
}
thanks. i read https://autohotkey.com/docs/commands/Gui.htm
Code: Select all
newGui2(200,"titleOrSo1902121943")
WinSet, AlwaysOnTop, On, titleOrSo1902121943
FormatTime, timestampHHmmss, %A_now%,HH:mm:ss
GuiControl, , D, %timestampHHmmss% %return_from_LineNumber%:%actionList% | %activeTitle%
; ^- works
newGui2(100,"title1902141119")
; ^- works
newGui2(y , title ) {
global D ; global D works. the variable is called D, not vD
; Get Current Position
SysGet,Mon_BboxNew_,Monitor,0
; y := Mon_BboxNew_Bottom - 170
x := Mon_BboxNew_Right - 170
Gui New, +AlwaysOnTop +ToolWindow -SysMenu -Caption
Gui, Color, green
Gui, Font, cWhite s10 q1, Arial Narrow ;red ; changed s11 to s10
str := "huibuhh huibuhh huibuhh huibuhh huibuhh huibuhh huibuhh "
Gui, Add, Text, vD y0 , %str%
; Gui, Add, Text, D y0 , %str% ; invalid option
;GuiControl, , D, %timestampHHmmss% %return_from_LineNumber%:%actionList% | %activeTitle%
Gui, Show, NoActivate x+%x% y%y%,%title% ; screen position here
; y := Mon_BboxNew_Bottom - 270
x := Mon_BboxNew_Right - 270
Gui, Show, NoActivate x+%x% y%y%,%title% ; screen position here
; WinSet, TransColor, green 255,titleOrSo ; 255 is max tansparent
}
Code: Select all
hwndGui1 := newGui()
Gui, %hwndGui1%:Show, NoActivate x+%x% y%y% ; ,titleOrSo
y := 270
x := 270
hwndGui2 := newGui()
Gui, %hwndGui2%:Show, NoActivate x+%x% y%y% ; ,titleOrSo2
GuiControl, %hwndGui2%: D, 22222222, ahk_id %hwndGui2%
GuiControl, %hwndGui1%: D, 11111111, ahk_id %hwndGui1%
Code: Select all
GuiControl, %hwndGui2%:, 22222222, D
for some reasons this is not working. changes nothing.
Code: Select all
if(1){
; Get Current Position
SysGet,Mon_BboxNew_,Monitor,0
y := Mon_BboxNew_Bottom - 170
x := Mon_BboxNew_Right - 170
hwndGui1 := newGui()
Gui, %hwndGui1%:Show, NoActivate x+%x% y%y% ; ,titleOrSo
y := Mon_BboxNew_Bottom - 170
x := Mon_BboxNew_Right - 70
hwndGui2 := newGui()
Gui, %hwndGui2%:Show, NoActivate x+%x% y%y% ; ,titleOrSo2
GuiControl, %hwndGui2%: D, 22222222, ahk_id %hwndGui2%
GuiControl, %hwndGui2%, 22222222, D
GuiControl, %hwndGui1%, 11111111, D
; ^- not working
GuiControl:, %hwndGui2%:, 22222222, D
GuiControl:, %hwndGui1%:, 11111111, D
; ^- not working
}
newGui() {
global D ; global D works. the variable is called D, not vD
Gui, New, +AlwaysOnTop +ToolWindow -SysMenu -Caption +Hwndhwnd ; <<< this here
Gui, Color, green
Gui, Font, cWhite s10 q1, Arial Narrow ;red ; changed s11 to s10
loop,200
str .= "_/\"
Gui, Add, Text, vD y0 , %str%
return hwnd
}
Code: Select all
GuiControl, SubCommand, ControlID , Value
Code: Select all
GuiControl, , %hwndGui2%:D, 22222222
Code: Select all
If (1){
; Get Current Position
SysGet,Mon_BboxNew_,Monitor,0
y := Mon_BboxNew_Bottom - 170
x := Mon_BboxNew_Right - 170
Gui1 := newGui()
Gui, % Gui1.HGUI . ":Show", NoActivate x%x% y%y% ; ,titleOrSo
y := Mon_BboxNew_Bottom - 170
x := Mon_BboxNew_Right - 70
Gui2 := newGui()
Gui, % Gui2.HGUI . ":Show", NoActivate x%x% y%y% ; ,titleOrSo2
Sleep, 1000
GuiControl, , % Gui1.HTXT, 11111111
GuiControl, , % Gui2.HTXT, 22222222
}
Return
GuiEscape:
ExitApp
newGui() {
Gui, New, +AlwaysOnTop +ToolWindow -SysMenu -Caption +HwndHGUI
Gui, Color, Green
Gui, Font, cWhite s10 q1, Arial Narrow ;red ; changed s11 to s10
Loop, 200
Str .= "_/\"
Gui, Add, Text, y0 hwndHTXT, %Str%
Return {HGUI: HGUI, HTXT: HTXT}
}
Thanks ! I like your `option` code. Works fine and i dont need a global command inside. everything encapsulated. There are always variants. Surprised. I take these. I think I have the better overview with your `option`. both works.
Code: Select all
Gui1 := toolTipGui(10,10,"1 1 1 1")
GuiControl, , % Gui1.HTXT, 11111111
Gui2 := toolTipGui(10,100,"2 2 2 2")
toolTipGui(x, y, text, bgColor := "Green"){
Gui, New, +AlwaysOnTop +ToolWindow -SysMenu -Caption +HwndHGUI
Gui, Color, %bgColor%
Gui, Font, cWhite s10 q1, Arial Narrow ;red ; changed s11 to s10
Gui, Add, Text, y0 hwndHTXT, %text%
; Return {HGUI: HGUI, HTXT: HTXT} ; Gui1 := toolTipGui()
Gui1 := {HGUI: HGUI, HTXT: HTXT}
Gui, % Gui1.HGUI . ":Show", NoActivate x%x% y%y% ; ,titleOrSo
return Gui1 ; older:
}