I'm an automation engineer at a factory and I've made a few AHK GUI's to collect user input for some of my processes. For some reason, this GUI is acting strangely. The purpose is to read the "status" of a process by pulling keywords from a "status.txt" file. The GUI then updates the picture "PicData" according to what step it is in the process.
My problem is the picture will only update when I click on the picture. I expected GuiControl,, StatusPic, %PicData% to update the picture even when the GUI was inactive. I've tried forcing the GUI to be "+AlwaysOnTop" or trying to activate the GUI with WINACTIVATE but still no luck. I still have to click the image to see if there were any changes. Does the Picture being controlled need to have focus for the changes to be seen? That's what i'm currently thinking, but not sure the best method to do this.
Anyways, here is my code:
Code: Select all
;3D SCAN STATUS
#NoEnv
#singleinstance force
StatusDirectory = F:\Shared\GEOMAGIC\System\status.txt ;Update the status via the status text file
PictureDirectory = F:\Shared\GEOMAGIC\Layout Pictures ;Update the corresponding image to the status
ReportDirectory = F:\Shared\GEOMAGIC\Reports ;Location to retrieve Geomagic Report
status1 = scan ;Scan will always be the first word, sets loop variable
timerm := "00"
timers := "00"
stopped := "0"
Start:
Gui,+AlwaysOnTop
Gui, Color, white
Gui, Font, s48 bold, Calibri
Gui, Add, Picture, X10 Y10 vStatusPic gUpdate,
Gui, Add, Text, x500 y500 w160 h120 vTText, %timerm%:%timers%
;~ Gui, Add, Text, vStatusText, blank
Gui, Font,
Settimer, Stopwatch, 1000
GuiControl +BackgroundTrans, TText
Gui, Show, h800 w1150, 3D SCAN STATUS
Update:
FileReadLine, status, %StatusDirectory%, 1
GUIControl,, StatusText, %status%
PicData = %PictureDirectory%\%status%.png
GUIControl,, StatusPic, %PicData%
IfNotEqual, status, %status1%
{
status1 = %status%
IfEqual, status, error
{
Settimer, Stopwatch, off
}
else
{
sleep, 10
}
Gui, Submit, NoHide
;~ Goto, Start
}
else
{
sleep, 1000
}
Stopwatch:
timers += 1
if(timers > 59)
{
timerm += 1
timers := "0"
GuiControl, , TText , %timerm%:%timers%
}
if(timers < 10)
{
GuiControl, , TText , %timerm%:0%timers%
}
else
{
GuiControl, , TText , %timerm%:%timers%
}
return
GuiClose:
GuiEscape:
ExitApp
return