Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Small mistake in script


  • Please log in to reply
1 reply to this topic
SecretAgent
  • Members
  • 1 posts
  • Last active: Oct 31 2015 03:18 AM
  • Joined: 28 Oct 2015

Basically, made a script that is supposed to send macros to every instance of game opened. The problem is, it doesn't work, it sends B once and then stops working for some reason... If i simply put ahk_class [ GameX ] instead of [ % "ahk_id " winList%a_index% ] it works perfectly

\::Pause, Toggle
]:: WinGet, winList, List, ahk_class GameX 
Loop % winList 
{
ControlSend, , b, % "ahk_id " winList%a_index% 
Sleep, 2000 
ControlSend, , {Numpad1},% "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , {Numpad2},% "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , {Numpad3},% "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , 1, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , 2, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , e, % "ahk_id " winList%a_index% 
Sleep, 4500 
ControlSend, , {Numpad1}, % "ahk_id " winList%a_index% 
Sleep, 100
ControlSend, , {Numpad2}, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , {Numpad3}, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , 1, % "ahk_id " winList%a_index%
Sleep, 100 
ControlSend, , 2, % "ahk_id " winList%a_index% 
Sleep, 100
ControlSend, , e, % "ahk_id " winList%a_index% 
Sleep, 4500 
ControlSend, , {Numpad1}, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , {Numpad2}, % "ahk_id " winList%a_index% 
Sleep, 100
ControlSend, , {Numpad3}, % "ahk_id " winList%a_index%
Sleep, 100 
ControlSend, , 1, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , 2, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , e, % "ahk_id " winList%a_index% 
Sleep, 4500 
ControlSend, , {Numpad1}, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , {Numpad2}, % "ahk_id " winList%a_index%
Sleep, 100 
ControlSend, , {Numpad3}, % "ahk_id " winList%a_index%
Sleep, 100 
ControlSend, , 1, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , 2, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , e, % "ahk_id " winList%a_index% 
Sleep, 4500 
ControlSend, , {Numpad1}, % "ahk_id " winList%a_index% 
Sleep, 100
ControlSend, , {Numpad2}, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , {Numpad3}, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , 1, % "ahk_id " winList%a_index% 
Sleep, 100 
ControlSend, , 2, % "ahk_id " winList%a_index%
Sleep, 100 
ControlSend, , e, % "ahk_id " winList%a_index% 
Sleep, 4500 
}
Return
 Thanks for help if any!

 

EDIT: added codebox and brackets



HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008

I have added codebox and brackets to your loop, try again.

If you put a WinWait % "ahk_id " winList%a_index%  as first line after Loop, you will not need the parameter for Controlsend and can use ControlSend, , e