Siwa Posted March 29, 2017 Share Posted March 29, 2017 I am writing an automated script, I want to create a GUI to inform my self which state the script is in, and what script is executing the moment I look at my computer's monitor, and if it halts, I am able to reset the program to that state it was on. my code is a loop, that look into a text file, picks up some numbers, and gets data from a chrome webpage based on those numbers, then the script continues and does what it must, but I want to be able to create a GUI that is refreshed with my line number ( a variable I must pass to the GUI) every time the loop restarts and also be able to send some variables to my GUI while other scripts execute. ( and I want it to be on top, because I run multiple programs on my computer and I set the chrome TOPMOST, so this GUI needs to be more TOPMOST every time it is passed a variable ) Please help me complete my coding, Thanks a lot in advance. Link to comment Share on other sites More sharing options...
Siwa Posted March 29, 2017 Author Share Posted March 29, 2017 (edited) I found I can refreash the variable every x time with AdlibRegister which is nice, but everytime the mouse clicks on chrome webpage, because of the topmost attribute i set for the chrome, my gui goes to back even with $WS_EX_TOPMOST i set for my GUI. Even I set GUISetStyle within my AdlibRegister function, but still my GUI goes to back. any help here ? Edited March 29, 2017 by Siwa Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 29, 2017 Moderators Share Posted March 29, 2017 @Siwa it is extremely difficult to assist you when you provide no code to see. You're asking us to first guess at what you're doing, and then help you troubleshoot. Help us help you by either posting the original code or at the very least a reproducer that shows what you're trying to accomplish. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Siwa Posted March 29, 2017 Author Share Posted March 29, 2017 (edited) 1 hour ago, JLogan3o13 said: @Siwa it is extremely difficult to assist you when you provide no code to see. You're asking us to first guess at what you're doing, and then help you troubleshoot. Help us help you by either posting the original code or at the very least a reproducer that shows what you're trying to accomplish. @JLogan3o13 You are right, here is my code : expandcollapse popupGlobal $age Global $Row Global $Count Local $aInput $file = "c:\mine.txt" $tCur = @YEAR&"_"&@MON&"_"&@MDAY&"-"&@HOUR&"_"&@MIN $pathtocreatefile = "C:\mine-done-"&$tCur&".txt" _FileCreate($pathtocreatefile) $linenumber=1 Local $iCountLines = _FileCountLines("c:\mine.txt") $handle2= ShellExecute("chrome.exe", "https://www.autoitscript.com/forum/","","") Sleep(2000) WinSetOnTop(WinGetTitle("[ACTIVE]"), "", 1) AdlibRegister("UpdateProgressWindow", 1000) Local Const $sFont = "Times New Roman" $Form1 = GUICreate("Show", 850, 20, -1, 2,BitOR($WS_BORDER, $WS_POPUP),$WS_EX_TOPMOST) _WinAPI_SetWindowPos($Form1,$handle2, 850, 20, -1, 2, $SWP_NOACTIVATE) $Label1 = GUICtrlCreateLabel("Line Number : "&$linenumber&" Age : "&$age, 25, 1, 800, 50) GUICtrlSetFont(-1, 12, $FW_NORMAL, $sFont) GUISetState(@SW_SHOW,$Form1) Func UpdateProgressWindow() GUICtrlSetData($Label1, "Line Number : "&$linenumber&" Age : "&$age) EndFunc While $linenumber<$iCountLines Beginning() $line = FileReadLine($file,$linenumber) ; Show($linenumber) if $line = "Done" Then FileWriteLine($pathtocreatefile, $line) _FileWriteToLine($file,$line,"Done",True) $linenumber = $linenumber +1 ContinueLoop EndIf Global $splitarray = _StringExplode($line," ",0) ;_ArrayDisplay($splitarray) Global $iRows = UBound($splitarray, 1) Global $PatientCode = $splitarray[0] $Row = $Row + 1 Sleep(500) ; Search() ; IsThereAnyone() If $Count = 0 Then $linenumber = $linenumber +1 ContinueLoop EndIf MouseClick("left",436,657,1) Sleep(1200) ; GetAge() Sleep(1200) ; Situation() Sleep(1200) FileWriteLine($pathtocreatefile, $line) _FileWriteToLine($file,$line,"Done",True) $linenumber = $linenumber +1 WEnd Func Beginning() MouseClick("left",201,48,1) Send("{CTRLDOWN}a{CTRLUP}") Send("https://www.autoitscript.com/forum/") Sleep(500) Send("{ENTER}") Sleep(2500) MouseClick("left",1717,236,1) Sleep(500) MouseClick("left",1662,292,1) EndFunc and a short example of the content of the mine.txt file located in C:\ Quote 3839736587 3839516714 Edited March 29, 2017 by Siwa Link to comment Share on other sites More sharing options...
Siwa Posted March 29, 2017 Author Share Posted March 29, 2017 I am able to add WinSetOnTop("Show","",$WINDOWS_ONTOP) to UpdateProgressWindow() and reduce the refresh rate to as low as 500 ms, but it gives a continues refreshing view on the gui which is not very nice. Any Solution, to bring a GUI on the front end of another already TOPMOST window ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now