ddxfish 0 Posted July 4, 2014 (edited) I have a GUI designed with a status message, and a progress bar. I want to make a function that changes the progress bar value on this active GUI window (ProgressOn is not a versatile enough solution). Here are the 2 functions I have so far, the first opens the GUI and the second is supposed to change the progress bar value by inputting the new percent, but does not work. I was hoping to call my function setStatusGui(50) to set the percent to 50. Any help would be greatly appreciated! EDIT: updated code to run as I see it #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $currentStatus = "Not started yet" Global $currentStatusHeader = "Long Script - Paused" Global $currentProgress = 0 Func openStatusGUI() #Region ### START Koda GUI section ### Form= Global $simpleForm = GUICreate("Script Status", 504, 247, 192, 124) Global $simpleTitle = GUICtrlCreateLabel($currentStatusHeader, 11, 8, 481, 49, $SS_CENTER) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") Global $simpleStatusmsg = GUICtrlCreateLabel($currentStatus, 23, 88, 456, 49, $SS_CENTER) Global $simpleProgress = GUICtrlCreateProgress(24, 184, 454, 49, $WS_BORDER) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc ;==>openStatusGUI Func setStatusGui($newprogress) GUICtrlSetData($simpleProgress, $newprogress) EndFunc ;==>setStatusGui ;Execution openStatusGUI() Sleep(1000) setStatusGui(66) Edited July 4, 2014 by Jos Share this post Link to post Share on other sites
Jos 2,164 Posted July 4, 2014 Welcome, please post a script that can run and shows what you are trying to do as the setStatusGui() will nicely update the progressbar. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
ddxfish 0 Posted July 4, 2014 I edited the original code, sorry about that. I see the GUI load, and expect for the progress bar to change to 66% after a 1000 msec sleep, but it stays at 0. Share this post Link to post Share on other sites
Jos 2,164 Posted July 4, 2014 (edited) Updated your code to be in a codebox for easier reading. Your Gui is locked into your Message loop so never reaches the setStatusGui() line. Jos Edited July 4, 2014 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
ddxfish 0 Posted July 4, 2014 (edited) Jos, Thanks so much for the help. I made a bonehead mistake there. Here is the working code. #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $currentGuiStatus = 0 Global $currentStatus = "Not started yet" Global $currentStatusHeader = "Long Script - Paused" Global $currentProgress = 0 Func openStatusGUI() $currentGuiStatus = 1 #Region ### START Koda GUI section ### Form= Global $simpleForm = GUICreate("Script Status", 504, 247, 192, 124) Global $simpleTitle = GUICtrlCreateLabel($currentStatusHeader, 11, 8, 481, 49, $SS_CENTER) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") Global $simpleStatusmsg = GUICtrlCreateLabel($currentStatus, 23, 88, 456, 49, $SS_CENTER) Global $simpleProgress = GUICtrlCreateProgress(24, 184, 454, 49, $WS_BORDER) GUISetState(@SW_SHOWNORMAL) #EndRegion ### END Koda GUI section ### EndFunc ;==>openStatusGUI Func setStatusGui($newprogress) GUICtrlSetData($simpleProgress, $newprogress) EndFunc ;==>setStatusGui ;Execution openStatusGUI() Sleep(1000) setStatusGui(66) Sleep(1000) Edited July 4, 2014 by ddxfish Share this post Link to post Share on other sites
Jos 2,164 Posted July 4, 2014 (edited) You will have to create some sort of loop to keep the program active, but that isn't an issue really. Just use the GUIOnEventMode mode to trigger any actions from the GUIControls and use an AdlibRegister() to activate another function at a defined interval. Jos Edited July 4, 2014 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites