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 

problem getting hot keys specific to an application

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





PostPosted: Sun May 01, 2005 5:17 am    Post subject: problem getting hot keys specific to an application Reply with quote

I use Delphi 5 for my work, and the editor doesn't provide a Ctrl-a select all shortcut, so I figured I would use autohotkey to produce one. Ideally I'd like for Ctrl-a to give me a select all in Delphi, and just work as normal in other applications, so I figured the following would work
Code:
^a::
ifWinActive, ahk_class TEditWindow
{
  Send, ^{HOME}
  Send, ^+{END}
}
else
  Send, ^a
return

However, the Ctrl-a doesn't work in other applications for some reason. They don't seem to like taking the Ctrl-a from the Send command. I could map the hotkey to something else, but I would preferr not to. Can anyone tell me if it's possible to do what I'm after?

For the moment I have it working by suspending all hotkeys when I'm not on the Delphi window, but that suck, because it means that I can only use Autohotkey for Delphi.

Any Help greatly appreciated.
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Sun May 01, 2005 10:37 am    Post subject: Reply with quote

The only thing missing is a $ in front of the ^a on the top line. This allows a hotkey to send itself, which is otherwise impossible because the hotkey would try to trigger itself. The following slightly more pure hotkey might also work if Delphi normally ignores ^a:
Code:
~^a::
ifWinActive, ahk_class TEditWindow
{
  Send, ^{HOME}
  Send, ^+{END}
}
return
Back to top
View user's profile Send private message Send e-mail
reynoldscr
Guest





PostPosted: Sun May 01, 2005 10:48 am    Post subject: Reply with quote

sweet, thanks for that.

I figured there must be a way to prevent the supressionof the hotkey's normal action, but I had managed to miss the usage of "$" and "~" in the help. That will teach me to look harder in the future.

Thanks a lot Chris, know I had my suspicions that this can be done, I'm sure I'm going to find a lot more uses for this great application.

Cheers.
Back to top
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