Jump to content
Sign in to follow this  
JerryI

Multi-program control

Recommended Posts

JerryI

I have written a script that interacts with a website, but because of site response times, etc. the script tends to hang in any of various while-wend loops. Intending to use this as a slave script, I have written a master script that looks at various pixels to conclude when activity has ceased for a selected time interval. When that happens I would like this master script to shut down the slave program and restart it. I need some general guideline or an example script to set up this master-slave relationship, and also some hints on a technique to close the running (hung) program with the external master program. I thought that I would be able to use Send("{ESCAPE}") to effectively shut down the hung program (or even a non hung running program), but that does not seem to be the case, i.e. an ESC sent externally does not seem to have the same effect as pressing the ESC key. Is there perhaps a method to pass a value for a variable into the slave script from outside and then put a line like ( If $var = "hung" Then Exit ) inside each suspect While-Wend loop? Then, once the slave script shuts down, I could have the master script click a desktop icon to restart the slave script.

Edited by JerryI

Share this post


Link to post
Share on other sites
somdcomputerguy

If I had to do what you've said needs to be done, I'd use these functions to start with..

PixelChecksum or PixelGetColor or PixelSearch

WinClose/Run any au3 File from Your Program/Re-Start your Program

To pass data from one script/program to another, Command Line Parameters can be used.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Tvern

I'm not trying to be negative, but it seems like your approach is impractical.

In my oppinion you're relying on pixelchecking and simulated mouse and keyboard action, where there are easier and more reliable options.

You say your script interactis with a website. Unless you are talking about some embedded content in a website (like flash) the _IE functions usually give a very good result. Sometimes evaluating the page source can be usefull too. To check if the script hangs It's normally best to check why it hangs and write a fix for it, rather then having another program using visual information to decide it's time for a restart.

To find out at what point your script hangs (if that's an issue) you can use Scite4AutoIT to add (func) trace lines to your script.

If you're not doing anything confidential, a link to the website and description of what you want to do will usually earn you a few examples.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×