| View previous topic :: View next topic |
| Author |
Message |
HelgeFin
Joined: 04 Apr 2007 Posts: 12
|
Posted: Wed Apr 04, 2007 7:30 pm Post subject: Workaround to trigger Hotstrings by an exchanged key? |
|
|
Hi everyone!
I have done quite some digging in different documentation about AutoHotKey, but I couldn't find a solution to the following problem. I hope somebody can help:
On my job we have to do lots of math typesetting using Latex (http://en.wikipedia.org/wiki/LaTeX). All commands begin with a backslash. At least on the German keyboard the backslash is very unconvenient to type. Thus I put the backslash on the Caps Lock key using Ahk.
But now I would like to use hotstrings with the backslash. E. g.:
::\a::\alpha
Well, this doesn't work, when I use the Caps Lock key to produce the backslash. I know that is by design. But I wonder if anyone can produce a workaround to this behavior.
Thanks for anything helpful,
Helge from Germany
 |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Wed Apr 04, 2007 8:26 pm Post subject: |
|
|
is there some key other than CapsLock you can use for \?
Have you tried:
| Code: |
CapsLock & a::Send, \alpha
|
(requires holding capslock while you press a)
is / convinient?
_________________
(Common Answers) |
|
| Back to top |
|
 |
HelgeFin
Joined: 04 Apr 2007 Posts: 12
|
Posted: Thu Apr 05, 2007 4:18 pm Post subject: |
|
|
Thank you for your comments!
| Quote: | | is there some key other than CapsLock you can use for \? |
The only viable alternative would be '#' on the German keyboard layout, but it is just the same problem with '#'.
| Quote: | | CapsLock & a::Send, \alpha |
Won't work because there are many other shortscuts like
\ed = \end{document}, which require multiple character Hotstrings.
No, because there are hundreds of commands and it would be to much work to define shortcuts for all of them. All commands regardless if it is a Hotstring or not should start with the same character. It is confusing to if you have to start abbreviated commands with a different character than hand-typed commands. And LaTeX-Commands start with "\".
Helge |
|
| Back to top |
|
 |
jps
Joined: 02 Sep 2006 Posts: 279 Location: Scotland
|
Posted: Thu Apr 05, 2007 9:31 pm Post subject: |
|
|
| Code: | Capslock::
Send, \
Input, Var, L1 V T3
If Var = a
Send, {backspace 2}\alpha
If Var = b
Send, {backspace 2}\beta
; etc etc
Return |
Obviously the backspaces arent needed for that example but they would be for any others where the first 2 characters arent at the start of the string to be sent
EDIT: Just read your second post about needing multiple letter hotstrings.That method would need more code if the hotstrings will be of varying length.
I suppopse you could up the input length and then check each letter of the string that was input or add every letter as an endkey and then have extra Input commands depending on what key was pressed
EDIT2: Just had a thought.You could use actual hotstrings for when you want to use multiple letters by checking if the last pressed hotkey was capslock
| Code: | :B0*:ed::
If A_PriorHotkey = Capslock
send, {Backspace 3}\end
return |
|
|
| Back to top |
|
 |
HelgeFin2 Guest
|
Posted: Tue Sep 16, 2008 2:10 pm Post subject: |
|
|
Thanks a lot! That works great! This is my version, with where the number of backspaces is not needed to be changed when the length of the Hotstring changes. It is triggered by "\test".
| Code: | :*:test::
If A_PriorHotkey = Capslock
Send,{Backspace 1}
Send,\end
return
|
|
|
| Back to top |
|
 |
|