AutoHotkey Community

It is currently May 27th, 2012, 12:04 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: October 6th, 2009, 3:26 pm 
Offline

Joined: May 26th, 2009, 6:09 am
Posts: 8
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 6th, 2009, 3:28 pm 
Offline

Joined: November 14th, 2007, 2:47 pm
Posts: 335
Location: London, England
#IfWinActive


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 6th, 2009, 3:28 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
IfWinActive?

IfWinNotActive, IfWinExist


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 6th, 2009, 3:29 pm 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 6th, 2009, 4:35 pm 
Offline

Joined: May 26th, 2009, 6:09 am
Posts: 8
thank you
also thanks for settitlematchmode


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google [Bot], Leef_me, Pulover, XstatyK, Yahoo [Bot] and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group