> ...
new to Autoit, what do I put in the ()
You might have already done some of the steps below:
Once AutoIt is installed...
...right click on an empty place on your desktop
...and select
New >
AutoIt v3 Script from the context menu.
Once the new file has been created...
...right click on it and select
Edit Script from the context menu.
You should now be in an application named SciTE. Once you enter the function named WinExists into SciTE, you can place the edit cursor next to or inside that WinExists function and press F1. That should open the help file to the WinExists function. There should be examples on how to use that WinExists function in the help file.
>
Also this will run when a program starts until it exits?
If by
this, you mean the script, then:
Script will run when a program starts...
No; the script will not automatically start when some other programs starts.
...
until it exits?
Does "it" refer to the script or "a program"?
My guess is: "it" refers to "a program".
Either way, the wording does not matter much. More on this
later.
The script does this...
>
I am currently trying to make a program start when another one opens.
...but probably not in the way that you want. More on this
later.
In the pseudo code that I posted:
the "Run" line of code is there to
make a program start...
...when another one opens - is handled by the Do/Sleep/Until code.
This is
later
Frankly, I saw no need for a script like this, because I batch file could do this too. Since you said that a batch file would not work, I figured that I did not understand what you really wanted. I knew that we would need to exchange more posts until I had a better understanding of what you are after.
>
It would also be nice if the program ended when the first program shuts down.
I ignored this. I figured that we would get back to it once we understood the task at hand.
You mentioned using a scheduled task. By default, an app called taskeng.exe is running all of the time. That app watches for trigger events that match scheduled tasks. To use a script, it too would need to be running all of the time - to watch for events that match your desired conditions. To have one script handle multiple events is possible, but it won't be as simple as the few lines of pseudo code that I posted.
Here is an outline of what I think you are after:
loop starts here
if a window that matches app1 shows up, then automatically run app2
when the window for app1 goes away, then automatically close app2
if a window that matches app3 shows up, then automatically run app4
when the window for app3 goes away, then automatically close app4
those lines get repeated for as many pairs of apps as you want
return to where the loop starts
Does it sound like I'm getting closer to what you are after?