unibotsi 7 Posted December 31, 2018 Report Share Posted December 31, 2018 Hey there Is it possible to do "something" while a specific task is running? What I´d like to achieve, is kind of an alive/status check. While performing a define wrapped task, I´d need to check if the user(bot) still is logged in. Basically: define (Search Something) Loop through pages Search and Collect DataAt the moment i navigate to a page which is only visible if logged in. Then i check the page for a string. If the string is not there, id did not get to that page, which means i am not logged in. I could check that at the end of every loop, but that feels not right (plus it would take much longer to finish that task and more data would have to be saved in memory). I would prefer to do this as another thread which checks the login status while the define (Search Something) is running. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted December 31, 2018 Report Share Posted December 31, 2018 You can use another thread that loops while a task is running and it can set a global variable every so often to let you know if its still logged in or not. Quote Link to post Share on other sites
unibotsi 7 Posted December 31, 2018 Author Report Share Posted December 31, 2018 That sounds like what i search for. But how does the other thread know when to start and when to stop?I remember there was something for executing/stopping a task, but i do not remember what it was. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted December 31, 2018 Report Share Posted December 31, 2018 Here is an example in the real world you would want to maybe use something like in shared browser: ui stat monitor("Parallel Task",#parallelIncremnt) ui stat monitor("Long Running Task",#longRunningIncrement) set(#taskRunning,$true,"Global") thread { ParallelTask() } LongRunningTask() define ParallelTask { set(#parallelIncremnt,0,"Global") loop while(#taskRunning) { wait(1) increment(#parallelIncremnt) } alert("Parallel task finished!") } define LongRunningTask { set(#longRunningIncrement,0,"Global") loop(3) { wait(5) increment(#longRunningIncrement) } set(#taskRunning,$false,"Global") alert("Long running task finished!") } 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.