AutoHotkey Community

It is currently May 26th, 2012, 12:08 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: September 9th, 2008, 8:19 am 
Offline

Joined: June 3rd, 2008, 6:44 pm
Posts: 27
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2008, 9:17 am 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
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


:)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google Feedfetcher, kkkddd1, StepO and 19 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