0
votes

i work on a script and i use a super basic gui to track whats going on. since i log every step with it my code is cluttered with gui gui gui gui etc and i want to clean it up.

so instead of each time i do somehing using:

Gui Destroy
Gui, +AlwaysOnTop +Disabled -SysMenu +Owner  ; +Owner avoids a taskbar   button.
Gui, Add, Text,, script is starting now
Gui, Show, x-500 y400 NoActivate  ; NoActivate avoids deactivating the currently active window.

i want to use a a function to call the gui and give it the msg to display like:

infodisplay(hello world)


infodisplay(msg) 
{
Gui Destroy
Gui, +AlwaysOnTop +Disabled -SysMenu +Owner  ; +Owner avoids a taskbar button.
Gui, Add, Text,, msg
Gui, Show, x-500 y400 NoActivate  ; NoActivate avoids deactivating the currently active window.
}

But instead of a textfield with hello world i get a textfield with msg :( i read the help file twice but i dont really get how to handle functions.

can i use this at all? will this work? the idea is

some code ....
infodisplay(step 1)

more code
infodisplay(step 2)
1

1 Answers

0
votes

Use %s

infodisplay(msg) 
{
    Gui Destroy
    Gui, +AlwaysOnTop +Disabled -SysMenu +Owner  ; +Owner avoids a taskbar button.
    Gui, Add, Text,, %msg%

(You might wanna look into http://autohotkey.com/docs/Variables.htm)

And for edits to the gui, http://autohotkey.com/docs/commands/GuiControl.htm might also be interesting for you.

all the best,