Jump to content


Running a loop key in an inactive window.


  • Please log in to reply
8 replies to this topic

#1 Empy

Empy
  • Guests

Posted 08 June 2012 - 10:17 PM

I'm trying to take a simple code which loops key "9" (with added delay and sleep) and make this run in a game window which is minimized (inactive).
It works perfectly while the game is active/maximized however I'd like to be able to have this run in the background by itself without interfering with other things I have to do.

Here is the code for the simple loop:
loop, 1000
 {
   random, delay, 2000, 5000
   send, 9
   sleep, %delay%
 }
return

end::exitapp

Now I just need someone who can help me integrate that code into something that can make it run in an inactive window.
I've been suggested to use controlsend, however I'm not sure how to place the current with that.
If anyone has any ideas or can help, please let me know.

#2 engunneer

engunneer
  • Fellows
  • 9162 posts

Posted 08 June 2012 - 10:36 PM

Replace the send command with controlsend control send needs some other parameters like the name of the window. You can probably leave the control me blank in this case.

Please post what you tried if it still doesn't work.
Also, check the gaming forum or search for your game to see other options. Controlsend doesn't work for all games

#3 Empy

Empy
  • Guests

Posted 08 June 2012 - 10:53 PM

Not sure if I did this right, however now it doesn't work at all, not even when it's active.

loop, 1000
 {
   random, delay, 2000, 5000
   ControlSend, 9, ahk_class WFHalcyonClient Window
   sleep, %delay%
 }
return

end::exitapp

Maybe I'm missing something?

#4 engunneer

engunneer
  • Fellows
  • 9162 posts

Posted 09 June 2012 - 01:24 AM

ControlSend [, Control, Keys, WinTitle,...
becomes
ControlSend, , 9, ahk_class WFHalcyonClient Window ;,other parameters blank

#5 Empy

Empy
  • Guests

Posted 09 June 2012 - 04:04 AM

Thanks, that worked perfectly.

#6 Layarion

Layarion
  • Members
  • 14 posts

Posted 22 February 2013 - 03:07 AM

ControlSend [, Control, Keys, WinTitle,...
becomes
ControlSend, , 9, ahk_class WFHalcyonClient Window ;,other parameters blank

that worked 98%...

 

wait a minute...got it to work %100 by switching ^v with {LCtrl down}{v}{LCtrl Up}

 

^v wasn't working when window was active, it just spammed the letter v



#7 Layarion

Layarion
  • Members
  • 14 posts

Posted 01 March 2013 - 05:59 AM

i need help with this, it's very unreliable. is it possible to make this use sendmode input?



#8 Andromon

Andromon
  • Members
  • 112 posts

Posted 30 March 2013 - 06:28 PM

Ok, so sorry for bumping a thread, but with a change similar to this, you can send clicks in a minimized windows and still use the mouse?

 

Or if not, I suppouse you can at least be typing with the keyboard?



#9 Layarion

Layarion
  • Members
  • 14 posts

Posted 01 April 2013 - 10:44 PM

not sure, but what i had did not interfere with what i was typing in other windows