I run some unsupervised workstations. At starttimme, alot of programs are loaded and setiings are made. I want to inform the user about the status of the startup process...
I made quite some progress today. Worked first time with arrays (pat on the back) and modyfing textcolor
![Bravo! :bravo:](./images/smilies/bravo.gif)
What killed me:
-> position :=++ somehow didn´t work, had to use position := position+1
->Gui, Add, Text, x30 y(%position%*30) w160 h25, %inhalt% didn´t work but Gui, Add, Text, % "x30" "y" (position*30) "w160" "h25", %inhalt% does
This is just a little script that displays some items and if you press the buttons, the red items will become green from top to bottom one at at time, just like a list of chores...
In future I´ll probably just call the function after a certain program is loaded, therefore I chose to use a separate function to display the GUI.
But what could I´ve done different, what could I improve?
I´m not happy about destroying and recreating the GUI as it creates some flicker, but found no other way...
Code: Select all
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Persistent
SetTitleMatchMode,2
SetTitleMatchMode, slow
DetectHiddenWindows, On
arrayitem := ["Apples", "Oranges", "Tomatoes", "Bananas", "Melons"]
global position :=0
global fertig :=-1
;MsgBox % ObjMaxIndex(arrayitem) " = " arrayitem.MaxIndex()
;MsgBox % ObjRawGet(arrayitem, position)
gosub, aktualisieren
return
aktualisieren:
Gui, Destroy
fertig := fertig+1
if (fertig>arrayitem.MaxIndex())
{
gosub, abbruch
}
position :=0
;MsgBox fertig%fertig% position%position%
Gosub,showlist
return
abbruch:
GuiClose:
ExitApp
return
showlist:
Gui, Show, w1200 h800, WATCHDOG
Loop
{
position := position+1
inhalt := objRawGet(arrayitem, position)
If (position>fertig)
{
Gui, Font, S15 cRed Bold, Verdana
}
else
{
Gui, Font, S15 cGreen Bold, Verdana
}
Gui, Add, Text, % "x30" "y" (position*30) "w160" "h25", %inhalt%
;SoundBeep
;MsgBox %inhalt% %position% wert
;sleep 1000
}
Until position > arrayitem.MaxIndex()
Gui, Add, Button, x112 y579 w250 h70 gaktualisieren , Aktualisieren
Gui, Add, Button, x472 y579 w350 h70 gabbruch, Abbruch
return
Thanks, Hendrik