AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Run 2 scripts at the same time?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Dannymet (guest)
Guest





PostPosted: Sun Jul 20, 2008 12:48 am    Post subject: Run 2 scripts at the same time? Reply with quote

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

PostPosted: Sun Jul 20, 2008 1:01 am    Post subject: Reply with quote

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
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1233

PostPosted: Sun Jul 20, 2008 2:10 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group