AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Beginner Question: Keyboard shortcut for special program

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
mborus



Joined: 21 Feb 2005
Posts: 3

PostPosted: Wed Feb 23, 2005 9:06 am    Post subject: Beginner Question: Keyboard shortcut for special program Reply with quote

Hi,

here's a double beginner question - hope you don't mind Smile

In this example I try to put the right mouse button on the
"q" button - when the Program "Textpad" is the active window.

I put this code into the autohotkey.ini

Code:

SetTitleMatchMode, 2
IfWinActive, TextPad
{
  q::
  Send, {RButton Down}
  KeyWait, q
  Send, {RButton Up}
  return



It doesn't work completely - it works all the time, no matter
if I use Textpad or not.

My two questions:

1. How can I detect that Textpad is running in the foreground (The Window title includes TextPad)
2. Does is make sense to scan for the key "q" and then for the window title, or should I scan the active window title first?
Back to top
View user's profile Send private message
ranomore



Joined: 06 Nov 2004
Posts: 178
Location: Salt Lake City, UT

PostPosted: Wed Feb 23, 2005 9:24 am    Post subject: Reply with quote

Code:
SetTitleMatchMode, 2
$q::
IfWinActive, Textpad
{
  Send, {RButton Down}
  KeyWait, q
  Send, {RButton Up}
}
Else
  Send, q
return


the $ makes it a pass-through hotkey.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
mborus



Joined: 21 Feb 2005
Posts: 3

PostPosted: Wed Feb 23, 2005 9:29 am    Post subject: Reply with quote

That works, thanks.
Back to top
View user's profile Send private message
SanskritFritz



Joined: 17 Feb 2005
Posts: 283
Location: Hungary, Budapest

PostPosted: Wed Feb 23, 2005 9:54 am    Post subject: Reply with quote

There is a little problem with this: the TextPad help window is also titled TextPad. So, an extra check for the processname would be helpful, like this:
Code:
   WinGet, sProcessName, ProcessName, A
   If sProcessName = TextPad.exe

_________________
Is there another word for synonym?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group