 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
mborus
Joined: 21 Feb 2005 Posts: 3
|
Posted: Wed Feb 23, 2005 9:06 am Post subject: Beginner Question: Keyboard shortcut for special program |
|
|
Hi,
here's a double beginner question - hope you don't mind
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 |
|
 |
ranomore
Joined: 06 Nov 2004 Posts: 178 Location: Salt Lake City, UT
|
Posted: Wed Feb 23, 2005 9:24 am Post subject: |
|
|
| 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 |
|
 |
mborus
Joined: 21 Feb 2005 Posts: 3
|
Posted: Wed Feb 23, 2005 9:29 am Post subject: |
|
|
| That works, thanks. |
|
| Back to top |
|
 |
SanskritFritz
Joined: 17 Feb 2005 Posts: 283 Location: Hungary, Budapest
|
Posted: Wed Feb 23, 2005 9:54 am Post subject: |
|
|
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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|