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 

Workaround to trigger Hotstrings by an exchanged key?

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



Joined: 04 Apr 2007
Posts: 12

PostPosted: Wed Apr 04, 2007 7:30 pm    Post subject: Workaround to trigger Hotstrings by an exchanged key? Reply with quote

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



Laughing
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Wed Apr 04, 2007 8:26 pm    Post subject: Reply with quote

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?
Code:

::/a::\alpha

_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
HelgeFin



Joined: 04 Apr 2007
Posts: 12

PostPosted: Thu Apr 05, 2007 4:18 pm    Post subject: Reply with quote

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.

Quote:
is / convinient?


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 "\".

Smile Helge
Back to top
View user's profile Send private message
jps



Joined: 02 Sep 2006
Posts: 279
Location: Scotland

PostPosted: Thu Apr 05, 2007 9:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
HelgeFin2
Guest





PostPosted: Tue Sep 16, 2008 2:10 pm    Post subject: Reply with quote

Thanks a lot! That works great! Very Happy 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
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