| View previous topic :: View next topic |
| Author |
Message |
kiwijunglist
Joined: 26 May 2009 Posts: 8
|
Posted: Tue Oct 06, 2009 2:26 pm Post subject: Only process hotkeys if certain window is active |
|
|
Hi
I made this script that allows me to cancel a recent reload when i press the left mouse button. I only want to run the script when the game window is active, what would the best way of acheiving that be?
Many thanks
| Code: |
#SingleInstance force
#InstallMouseHook
#InstallKeybdHook
Cancel_Reload = 0
*~r::
Cancel_Reload = 1
Sleep 1500
Return
*~f::
Cancel_Reload = 0
Return
*~WheelDown::
Cancel_Reload = 0
Return
*~LShift::
Cancel_Reload = 1
Return
*~LShift Up::
Sleep 500
Cancel_Reload = 0
Return
*~RButton::
Cancel_Reload = 0
Return
*~LButton::
If Cancel_Reload = 1
{
Send, 1
Send, 1
Cancel_Reload = 0
}
Return
|
|
|
| Back to top |
|
 |
doyle
Joined: 14 Nov 2007 Posts: 325 Location: London, England
|
Posted: Tue Oct 06, 2009 2:28 pm Post subject: |
|
|
| #IfWinActive |
|
| Back to top |
|
 |
Carcophan
Joined: 24 Dec 2008 Posts: 1308 Location: :noitacoL
|
Posted: Tue Oct 06, 2009 2:28 pm Post subject: |
|
|
IfWinActive?
IfWinNotActive, IfWinExist |
|
| Back to top |
|
 |
aaffe
Joined: 17 May 2007 Posts: 1002 Location: Germany - Deutschland
|
Posted: Tue Oct 06, 2009 2:29 pm Post subject: |
|
|
Try this.
Put the game window name instead of <GAME WINDOW>
| Code: |
#SingleInstance force
#InstallMouseHook
#InstallKeybdHook
SetTitlematchmode, 2
Cancel_Reload = 0
#IfWinActive,<GAME WINDOW>
*~r::
Cancel_Reload = 1
Sleep 1500
Return
*~f::
Cancel_Reload = 0
Return
*~WheelDown::
Cancel_Reload = 0
Return
*~LShift::
Cancel_Reload = 1
Return
*~LShift Up::
Sleep 500
Cancel_Reload = 0
Return
*~RButton::
Cancel_Reload = 0
Return
*~LButton::
If Cancel_Reload = 1
{
Send, 1
Send, 1
Cancel_Reload = 0
}
Return
#IfwinActive
|
|
|
| Back to top |
|
 |
kiwijunglist
Joined: 26 May 2009 Posts: 8
|
Posted: Tue Oct 06, 2009 3:35 pm Post subject: |
|
|
thank you
also thanks for settitlematchmode |
|
| Back to top |
|
 |
|