How to get the actual hotstring typed with capitalization in AutoHotKey?
How to get the actual hotstring typed with capitalization in AutoHotKey?
I am using hotstrings in AutoHotKey and want to store the word typed as a string. Is there a way to get the string typed while keeping capitalization data? I tried using A_ThisHotkey, but it does not seem to be case sensitive. Please let me know if you have a solution. Thanks.
Re: How to get the actual hotstring typed with capitalization in AutoHotKey?
Not absolutely sure what you are asking. Can you give an example?
Generally, by default, hotstrings replace case-conform. For example, this hotstring
will return hello world, if I type hw,
will return HELLO WORLD, if I type HW,
and will return Hello world, if I type Hello world.
If this is unwanted, you can add the C1 option.
Generally, by default, hotstrings replace case-conform. For example, this hotstring
Code: Select all
::hw::hello world
will return HELLO WORLD, if I type HW,
and will return Hello world, if I type Hello world.
If this is unwanted, you can add the C1 option.
Or rather this? The C option:https://www.autohotkey.com/docs/Hotstrings.htm#Options wrote:C1: Do not conform to typed case. Use this option to make auto-replace hotstrings case insensitive and prevent them from conforming to the case of the characters you actually type. Case-conforming hotstrings (which are the default) produce their replacement text in all caps if you type the abbreviation in all caps. If you type the first letter in caps, the first letter of the replacement will also be capitalized (if it is a letter). If you type the case in any other way, the replacement is sent exactly as defined. When using the #Hotstring directive, C0 can be used to turn this option back off, which makes hotstrings conform again.
C: Case sensitive: When you type an abbreviation, it must exactly match the case defined in the script. Use C0 to turn case sensitivity back off.
Re: How to get the actual hotstring typed with capitalization in AutoHotKey?
Basically, I'm passing the typed string as an argument for a python method to a python program. In order to get the string to send I've tried using A_ThisHotkey, but it does not have the proper capitalization from how I typed the word. For example, ::hw::PythonProgram.hello_world(A_ThisHotkey). That's more pseudo-code than functional code, but it should help you understand what I mean.
Re: How to get the actual hotstring typed with capitalization in AutoHotKey?
Code: Select all
::hw::
Send % "PythonProgram.hello_world(" . A_ThisHotkey . ")"
Return
Code: Select all
::hw::
StringUpper, str, A_ThisHotkey
Send % "PythonProgram.hello_world(" . str . ")"
Return

Re: How to get the actual hotstring typed with capitalization in AutoHotKey?
Probably:
Code: Select all
Loop {
Input, v,V,{Space}{Enter},hw`t,btw`t
If (ErrorLevel="Match")
MsgBox % v
}
Esc::ExitApp
Re: How to get the actual hotstring typed with capitalization in AutoHotKey?
@BoBo and @HotKeyIt I really don't understand your code at all please provide an explanation. Also, just to make it even clearer if I have not been clear enough, I will provide another example. If I have a hotstring triggered by "hello world" I want to be able to get and store the string that I actually typed to trigger the hotkey in a variable with the uppercase letters. This way, if I type "hello World" to trigger the hotstring, I would have a string stored in a variable "hello World."
Re: How to get the actual hotstring typed with capitalization in AutoHotKey?
Run the script and type 'hallo world', then hit Tab key:
Code: Select all
Loop {
Input, v,V,{Space}{Enter},hallo world`t
If (ErrorLevel="Match")
MsgBox % v
}
Esc::ExitApp
Re: How to get the actual hotstring typed with capitalization in AutoHotKey?
Hallo,
two case sensitive A_ThisHotkeys, try:
two case sensitive A_ThisHotkeys, try:
Code: Select all
:cx:hw::ToolTip,% A_ThisHotkey
:CX:HW::ToolTip,% A_ThisHotkey