Combine send to different windows and hold down to spam Topic is solved

Ask gaming related questions
Guest

Combine send to different windows and hold down to spam  Topic is solved

15 Apr 2018, 09:49

So I have two nifty scripts. This

Code: Select all

~1::
KeyWait 1
IfWinActive, World of Warcraft
{
ControlSend,, 1, ahk_id %wowid1%
ControlSend,, 1, ahk_id %wowid2%
ControlSend,, 1, ahk_id %wowid3%
ControlSend,, 1, ahk_id %wowid4%
ControlSend,, 1, ahk_id %wowid5%
Return
}

WinGet, wowid, List, World of Warcraft

~2::
KeyWait 2
IfWinActive, World of Warcraft
{
ControlSend,, 2, ahk_id %wowid1%
ControlSend,, 2, ahk_id %wowid2%
ControlSend,, 2, ahk_id %wowid3%
ControlSend,, 2, ahk_id %wowid4%
ControlSend,, 2, ahk_id %wowid5%
Return
}

WinGet, wowid, List, World of Warcraft

~3::
KeyWait 3
IfWinActive, World of Warcraft
{
ControlSend,, 3, ahk_id %wowid1%
ControlSend,, 3, ahk_id %wowid2%
ControlSend,, 3, ahk_id %wowid3%
ControlSend,, 3, ahk_id %wowid4%
ControlSend,, 3, ahk_id %wowid5%
Return
}

WinGet, wowid, List, World of Warcraft

~4::
KeyWait 4
IfWinActive, World of Warcraft
{
ControlSend,, 4, ahk_id %wowid1%
ControlSend,, 4, ahk_id %wowid2%
ControlSend,, 4, ahk_id %wowid3%
ControlSend,, 4, ahk_id %wowid4%
ControlSend,, 4, ahk_id %wowid5%
Return
}
and this:

Code: Select all

ifWinActive World of Warcraft
{
$1::
   Loop  
   {
    if not GetKeyState("1", "P")
      break
     Send 1 
     sleep 1
    }
return
}

ifWinActive World of Warcraft
{
$2::
   Loop  
   {
    if not GetKeyState("2", "P")
      break
     Send 2 
     sleep 1
    }
return
}

ifWinActive World of Warcraft
{
$3::
   Loop  
   {
    if not GetKeyState("3", "P")
      break
     Send 3 
     sleep 1
    }
return
}

ifWinActive World of Warcraft
{
$4::
   Loop  
   {
    if not GetKeyState("4", "P")
      break
     Send 4 
     sleep 1
    }
return
}
Could anyone give me an example of just one button?
Thanks in advance.
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Combine send to different windows and hold down to spam

16 Apr 2018, 09:00

Hey bud,

The actions on the first script will be sent after the buttons are released. When they are held the second script will be performing its function.
Simply write what must be done after the loop after the }. :)

Try this code:

Code: Select all

ifWinActive World of Warcraft
{
$1::
   Loop  
   {
    if not GetKeyState("1", "P")
      break
     Send 1 
     sleep 1
    }
IfWinActive, World of Warcraft
{
ControlSend,, 1, ahk_id %wowid1%
ControlSend,, 1, ahk_id %wowid2%
ControlSend,, 1, ahk_id %wowid3%
ControlSend,, 1, ahk_id %wowid4%
ControlSend,, 1, ahk_id %wowid5%
}
return


ifWinActive World of Warcraft
{
$2::
   Loop  
   {
    if not GetKeyState("2", "P")
      break
     Send 2 
     sleep 1
    }
	IfWinActive, World of Warcraft
{
ControlSend,, 2, ahk_id %wowid1%
ControlSend,, 2, ahk_id %wowid2%
ControlSend,, 2, ahk_id %wowid3%
ControlSend,, 2, ahk_id %wowid4%
ControlSend,, 2, ahk_id %wowid5%
}
return

ifWinActive World of Warcraft
{
$3::
   Loop  
   {
    if not GetKeyState("3", "P")
      break
     Send 3 
     sleep 1
    }
	IfWinActive, World of Warcraft
{
ControlSend,, 3, ahk_id %wowid1%
ControlSend,, 3, ahk_id %wowid2%
ControlSend,, 3, ahk_id %wowid3%
ControlSend,, 3, ahk_id %wowid4%
ControlSend,, 3, ahk_id %wowid5%
}
return


ifWinActive World of Warcraft
{
$4::
   Loop  
   {
    if not GetKeyState("4", "P")
      break
     Send 4 
     sleep 1
    }
IfWinActive, World of Warcraft
{
ControlSend,, 4, ahk_id %wowid1%
ControlSend,, 4, ahk_id %wowid2%
ControlSend,, 4, ahk_id %wowid3%
ControlSend,, 4, ahk_id %wowid4%
ControlSend,, 4, ahk_id %wowid5%
}
return


Cheers! :D
I am your average ahk newbie. Just.. a tat more cute. ;)

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 12 guests