The NEW Build Your Own Arcade Controls

Main => Software Forum => Topic started by: Connorsdad on August 07, 2013, 05:06:19 pm

Title: AHK help needed please
Post by: Connorsdad on August 07, 2013, 05:06:19 pm
I have 8 Ahk.exes loading at startup of windows, each one has a custom loop consisting of:

Code: [Select]
Loop
{
Process, Wait, process.exe
run blah blah
Process,WaitClose, process.exe
run blah blah
}

So Ahk_process1.exe would have:
Code: [Select]
Loop
{
Process, Wait, process1.exe
run blah blah
Process,WaitClose, process1.exe
run blah blah
}

Ahk_process2.exe would have:
Code: [Select]
Loop
{
Process, Wait, process2.exe
run blah blah
Process,WaitClose, process2.exe
run blah blah
}

etc etc etc

How do I combine these into one ahk?
Title: Re: AHK help needed please
Post by: keilmillerjr on August 10, 2013, 04:27:53 am
You can combine them, but autohotkey does not support multi-threading. It runs code one line at at time.
Title: Re: AHK help needed please
Post by: Connorsdad on August 10, 2013, 07:39:48 am
Only one of the processes will be active at any one time therefore only one loop will be active at any one time. How do I have all the loops in one ahk script?

Sent from Amstrad CPC464

Title: Re: AHK help needed please
Post by: Connorsdad on August 10, 2013, 10:24:06 am
Sussed it :)

Edit:
No I haven't :(

Sent from Amstrad CPC464
Title: Re: AHK help needed please
Post by: nitz on August 11, 2013, 12:56:11 am
Only one of the processes will be active at any one time...

If that's the case, I'm thinking something like this could work:

Code: [Select]
Loop
{

Process, Wait, process1.exe, 0.1
If (ErrorLevel != 0)
{
run blah blah
Process,WaitClose, process1.exe
run blah blah
}

Process, Wait, process2.exe, 0.1
If (ErrorLevel != 0)
{
run blah blah
Process,WaitClose, process2.exe
run blah blah
}

Process, Wait, process3.exe, 0.1
If (ErrorLevel != 0)
{
run blah blah
Process,WaitClose, process3.exe
run blah blah
}

}
Title: Re: AHK help needed please
Post by: Connorsdad on August 11, 2013, 09:16:31 am
Thank you nitz, absolute star :)

Much tidier now.
Title: Re: AHK help needed please
Post by: nitz on August 11, 2013, 04:46:38 pm
 :applaud:

Glad it worked for you.

 :cheers: