Automation
Automation
Hi. I am new to this forum. My query is I want to autocorrect 1T as 1000 and 10T as 10000 and so on. Here T will be 1000 and it will multiply the number before it and autocorrect the word. How can I achieve this through an ahk file.
Re: Automation
The easiest way is to make a number of auto-replace hotstrings:
It could be made to more generically replace the T with 000, but that would be more involved and not worth the effort and extra code if you have a relatively small number of cases. Would you really have more than 100T before you went with something like 1M, 10M, 100M? Or will you be using T with more than just multiples of 10, like 34T?
Code: Select all
::1T::1000
::10T::10000
::100T::100000
It could be made to more generically replace the T with 000, but that would be more involved and not worth the effort and extra code if you have a relatively small number of cases. Would you really have more than 100T before you went with something like 1M, 10M, 100M? Or will you be using T with more than just multiples of 10, like 34T?
Re: Automation
Code: Select all
#If !on
~1::
~2::
~3::
~4::
~5::
~6::
~7::
~8::
~9::
~0::
on := True
Input, str, V, -()[]{}:;'"/\`,.?!`n `tt
t := ErrorLevel = "EndKey:T"
Send % RegExMatch(str, "^\d*$") && t ? "{BS}000" : ""
on := False
Return
Re: Automation
Now mikeyww showed it's worth the effort to make it work for the generic case.
-
- Posts: 4326
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: Automation
Code: Select all
str := "1"
Loop 10
HotString( ":*:" . (str .= A_Index = 1 ? "" : "0") . "T", str*1000 )
Return
Re: Automation
@mikeyww
Sir, the code is working but with Keypad numbers only, not with the numpad keys.
The below mentioned 2 scripts working when they run individually but not in combination, how can I add these two scripts in one.
1.
2.
[Mod edit: [code][/code] tags added.]
Sir, the code is working but with Keypad numbers only, not with the numpad keys.
The below mentioned 2 scripts working when they run individually but not in combination, how can I add these two scripts in one.
1.
Code: Select all
#If !on
~1::
~2::
~3::
~4::
~5::
~6::
~7::
~8::
~9::
~0::
on := True
Input, str, V, -()[]{}:;'"/\`,.?!`n `tt
t := ErrorLevel = "EndKey:T"
Send % RegExMatch(str, "^\d*$") && t ? "{BS}000" : ""
on := False
Return
Code: Select all
#If !on
~1::
~2::
~3::
~4::
~5::
~6::
~7::
~8::
~9::
~0::
on := True
Input, str, V, -()[]{}:;'"/\`,.?!`n `ll
l := ErrorLevel = "EndKey:L"
Send % RegExMatch(str, "^\d*$") && l ? "{BS}00000" : ""
on := False
Return
Re: Automation
Ideas to get you started:
Code: Select all
#If !on
~Numpad1::
~Numpad2::
on := True
Input, str, V, -()[]{}:;'"/\`,.?!`n `ttl
t := ErrorLevel = "EndKey:T", l := ErrorLevel = "EndKey:L", n := RegExMatch(str, "^\d*$")
Send % n && t ? "{BS}000" : n && l ? "{BS}00000" : ""
on := False
Return
Re: Automation
This is the code I want.
@mikeyww
Thanks a lot, sir.
@mikeyww
Thanks a lot, sir.