 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Dannymet (guest) Guest
|
Posted: Sun Jul 20, 2008 12:48 am Post subject: Run 2 scripts at the same time? |
|
|
I would like to know if its possible to run 2 scripts at the same time... but in 1 script file
i have got this:
| Code: |
F1::
ToggleVar := !ToggleVar
SetTimer, ClickRand, -10
return
F12::
ExitApp
ClickRand:
loop
{
If !ToggleVar
Break
Random, RandSleep, 1800, 2000
Sleep, RandSleep
click, left
}
return
|
that auto clicks every 1.8 to 2 seconds. I would like that to also be able to randomly press F7 every 75 to 150 seconds. Is this possible without running 2 scripts? |
|
| Back to top |
|
 |
Dannymet
Joined: 18 Jul 2008 Posts: 7
|
Posted: Sun Jul 20, 2008 1:01 am Post subject: |
|
|
i want this
| Code: |
F1::
ToggleVar := !ToggleVar
SetTimer, ClickRand, -10
return
F12::
ExitApp
ClickRand:
loop
{
If !ToggleVar
Break
Random, RandSleep, 1800, 2000
Sleep, RandSleep
click, left
}
return |
and this
| Code: |
F1::
ToggleVar := !ToggleVar
SetTimer, ClickRand, -10
return
F12::
ExitApp
ClickRand:
loop
{
If !ToggleVar
Break
Random, RandSleep, 75000, 150000
Sleep, RandSleep
Send, {F7}
}
return |
to be running at the same time.. without 2 scripts open.. because then i have to press F12 twice to close it... and i dont know if pressing F1 would work by doing it twice..
I want it all to be activated using F1
ive tried having a run.ahk script that contains this
| Code: |
run %Folder%/click.ahk
run %Folder%/fkey.ahk
|
BUT IT JUST CANT FIND THE FILESSS |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1233
|
Posted: Sun Jul 20, 2008 2:10 am Post subject: |
|
|
| Code: | F1::
ToggleVar := !ToggleVar
SetTimer, ClickRand, -10
SetTimer, ClickRand2, -10
tts := A_TickCount
return
F12::
ExitApp
ClickRand:
If (A_TickCount - tts > 100) ; skip the first time
click, left
Random, RandSleep, 1800, 2000
If ToggleVar
SetTimer, ClickRand, -%RandSleep%
return
ClickRand2:
If (A_TickCount - tts > 100) ; skip the first time
send, {f7}
Random, RandSleep, 75000, 150000
If ToggleVar
SetTimer, ClickRand2, -%RandSleep%
return |
untested. Even though AHK is not multithreaded, as long as timer subroutines execute relatively quickly, you will probably never notice. _________________ My Home Thread [New: Vector Function Library]
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|