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 

How to toggle between 2 sets of hotkeys?

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



Joined: 03 Jun 2008
Posts: 27

PostPosted: Tue Sep 09, 2008 7:19 am    Post subject: How to toggle between 2 sets of hotkeys? Reply with quote

I have defined many hotkeys for marking up HTML (for example: shift-ctrl-i puts the selection in <em>-tags, and so on). Now I want to use these same hotkeys for marking up LaTeX files, ideally by pressing a toggle key to switch between the two sets of hotkeys.

My first guess was to include one of the sets (in .ahk files) depending on the state of a toggle variable, but the help file says that #Include can't be used in conditional clauses. What would be the best way to do this instead?
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Tue Sep 09, 2008 8:17 am    Post subject: Reply with quote

Refer AHK Doc for #IfWinExist command which allows context sensitive Hotkeys.

Here is a working template to understand from:

Code:
Gui -Caption +Owner
Gui, Show, x0 y0 w0 h0 NA, Hotkey-Setting-A
Return

#IfWinExist Hotkey-Setting ahk_class AutoHotkeyGUI
  #A:: Gui, Show, NA, Hotkey-Setting-A
  #B:: Gui, Show, NA, Hotkey-Setting-B
  #C:: Gui, Show, NA, Hotkey-Setting-C
#IfWinExist

#IfWinExist  Hotkey-Setting-A ahk_class AutoHotkeyGUI
  F1::MsgBox Hotkey-Setting-A F1
  F2::MsgBox Hotkey-Setting-A F2
  F3::MsgBox Hotkey-Setting-A F3
#IfWinExist

#IfWinExist  Hotkey-Setting-B ahk_class AutoHotkeyGUI
  F1::MsgBox Hotkey-Setting-B F1
  F2::MsgBox Hotkey-Setting-B F2
  F3::MsgBox Hotkey-Setting-B F3
#IfWinExist

#IfWinExist Hotkey-Setting-C ahk_class AutoHotkeyGUI
  F1::MsgBox Hotkey-Setting-C F1
  F2::MsgBox Hotkey-Setting-C F2
  F3::MsgBox Hotkey-Setting-C F3
#IfWinExist


Smile
_________________
URLGet - Internet Explorer based Downloader
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
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