This is very close to what you said you are looking to do, and the order doesn't matter (the advantage of named parameters), as the second GUI shows:
Code: Select all
#Requires AutoHotkey v2.0
status_GUI := create_GUI({name_GUI: "status_GUI", text: "hello", bgcolor: "blue", opt: "x880 y900 NoActivate"})
other_GUI := create_GUI({name_GUI: "other_GUI", bgcolor: "green", opt: "x880 y950 NoActivate", text: "goodbye"})
create_GUI(g) { ; name_GUI, text_GUI, bgcolor
g.name_GUI := Gui()
g.name_GUI.Opt("-Caption +ToolWindow +AlwaysOnTop")
g.name_GUI.BackColor := g.bgcolor
g.name_GUI.Add("Text", , g.text)
g.name_GUI.Show(g.Opt)
return g.name_GUI
}
; alernately flash the GUIs
loop 5 {
Sleep 500
status_GUI.Show
other_GUI.Hide
Sleep 500
status_GUI.Hide
other_GUI.Show
}
ExitApp