jorgenitales Posted November 17, 2018 Share Posted November 17, 2018 Hello, i just created an account but i read a lot in this forum. I digged some posts but i cannot find an answer that fits my script (or i cannot make it fit, which is the most probable answer). I used AdlibRegister to close a program every 15 minutes, and i also need to restart the script because i have many lines of code and if i end the process in the middle of a while inside the script it will never start from the begining of the main loop (which has all the lines) AdlibRegister('close', time) ; 15 minutes = time Func close() If ProcessExists("Process.exe") Then ProcessClose("Process.exe") EndIf EndFunc While 1 ;over 300 lines of code, if the process ends in the middle of a while it gets stuck there Wend So i was thinking about putting in the end of the close func a "script restart" so it would end the script when the func close is called (after 15 minutes) and it would start again from while 1, but i dont figure how can i do that. Its my first post so if you need more information or the way im thinking about is wrong please tell me im learning! c: Link to comment Share on other sites More sharing options...
jorgenitales Posted November 17, 2018 Author Share Posted November 17, 2018 Sorry if this is spam, i dont know if i can edit forum posts (i don't see the option) but i forgot to say that i tried making some kind of goto inside the close func that goes to the while 1, but as i read in the forum this doesnt exists and i cannot implement it well enough. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 17, 2018 Developers Share Posted November 17, 2018 1 minute ago, jorgenitales said: i don't see the option correct, that will come later when you are in the next group, so no worries. 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. Link to comment Share on other sites More sharing options...
Nine Posted November 18, 2018 Share Posted November 18, 2018 I can't figure it out why your script gets stuck after closing another process. But you have to know that AdLibRegister will pause your main script during the execution of the function close (). Maybe that is why, idk. You can also try _Timer_SetTimer instead of AdLibRegister. If that doesn't work, you could create a two scripts, one containing your while 1 loop. The other would contain the timer, that would close both your first script and the process.exe, and restart your first script just after. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
jorgenitales Posted November 18, 2018 Author Share Posted November 18, 2018 23 minutes ago, Nine said: I can't figure it out why your script gets stuck after closing another process. But you have to know that AdLibRegister will pause your main script during the execution of the function close (). Maybe that is why, idk. You can also try _Timer_SetTimer instead of AdLibRegister. If that doesn't work, you could create a two scripts, one containing your while 1 loop. The other would contain the timer, that would close both your first script and the process.exe, and restart your first script just after. Thanks for your answer, it gets stuck (i think) because it cannot end a while loop and ends the process, for example AdlibRegister('close', time) ; 15 minutes = time Func close() If ProcessExists("Process.exe") Then ProcessClose("Process.exe") EndIf EndFunc While 1 ;main loop While $flag = True ;code if flag is true Wend Wend if the 15 mins are insde the second while, the flag will be true and i cannot end that while because the process is not running anymore and still looks for the flag, so i need to get to the start main loop again. Link to comment Share on other sites More sharing options...
jorgenitales Posted November 18, 2018 Author Share Posted November 18, 2018 Sorry for doble post again, but i tried doing 2 scripts as you said and it worked, so i will try a bit more if i can do all in 1, but i have this working, thanks. Link to comment Share on other sites More sharing options...
Nine Posted November 18, 2018 Share Posted November 18, 2018 5 minutes ago, jorgenitales said: Sorry for doble post again, but i tried doing 2 scripts as you said and it worked, so i will try a bit more if i can do all in 1, but i have this working, thanks. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
caramen Posted November 19, 2018 Share Posted November 19, 2018 Check restart.au3 udf i can give you if you dont find it. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki 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