 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Thu May 06, 2004 5:19 pm Post subject: New command: Input (for hotstrings and auto-replace) |
|
|
This is an interim version that has the new Input command in it. If any of you have time and have an interest in this capability, perhaps you can test and out prior to Tuesday, which is when I plan to release the next version.
Here is a description of the new command, which has fairly far reaching capabilities:
http://www.autohotkey.com/docs/commands/Input.htm
And here is the special installer that contains this interim version of the program:
http://home.tampabay.rr.com/kodi/ahk/AutoHotkey1009-input.exe
Since this is a fairly major feature, following Rajat's wisdom and getting feedback, improvements, and corrections prior to release seems best. |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Thu May 06, 2004 10:20 pm Post subject: |
|
|
Installed and testing with different scripts. Everything looks good so far. Thanks again for another great addition to AutoHotkey.
thanks,
beardboy |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Fri May 07, 2004 3:04 pm Post subject: |
|
|
I've checked the new command....wow! ...very impressive!
| Quote: | | Non-character keys such as PageUp and Escape are not stored. |
not that i've any specific use for it right now... but is it possible to get keys like F1 etc stored?
some example script on this plz! ...i'd tested typing '[abtw' but that didn't work... maybe its used some other way. _________________
 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Fri May 07, 2004 5:38 pm Post subject: |
|
|
| Quote: | | not that i've any specific use for it right now... but is it possible to get keys like F1 etc stored? |
It's on the list for later. It might not get done for this version, mostly because I'm having trouble envisioning any realistic use for it.
| Quote: | | some example script on this plz! ...i'd tested typing '[abtw' but that didn't work... maybe its used some other |
The wildcard works for me, such as in this example:
#i::
Input, test2, *, , btw
msgbox "%test2%" (errorlevel = %errorlevel%)
return
Can you give an example of an Input that fails to work with it? |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Fri May 07, 2004 6:39 pm Post subject: |
|
|
| Code: | ~]::
Input, UserInput, VT3L5, {tab}, btw,otoh
SetKeyDelay, -1
if UserInput = btw
Send, {backspace 4}by the way
|
the above seems not to work.
and u can foget that F1 thing for now... was just something that came to my mind. rather i wanted to know if it was possible using AVAILABLE commands ... didn't want any change!  _________________
 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Fri May 07, 2004 8:54 pm Post subject: |
|
|
That example works for me. I thought you said there was a problem with the wildcard option, but you didn't include an asterisk in the options, so it needs an exact match.
Here is a revised version that uses the wildcard. I also changed it to use IfInString since that goes along with the wildcard approach:
| Code: | ~]::
Input, UserInput, *VT3L5, {tab}, btw,otoh
SetKeyDelay, -1
IfInString UserInput, btw
Send, {backspace 4}by the way
return |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Fri May 07, 2004 9:16 pm Post subject: |
|
|
Thoughts after viewing Rajat's new script:
Since one of the objectives of "hot strings" is to make them easy to define, perhaps some more high level features should be built-in to the program. For example:
AutoReplace, btw, by the way
...
AutoReplace, btw, OFF ; Turn off this hotstring.
Since such features could internally make use of the Input command, they might not be too hard to implement.
Another technique that might be worth documenting is the use of Gosub to avoid the "else if" ladder to handle the matches:
Input, UserInput, , {enter}, btw,otoh
if ErrorLevel = Match
Gosub, %UserInput%
return
btw:
Send, {bs 3}by the way
return
Another idea is to add an option that changes the interpretation of the MatchList so that every abbreviation is paired with some autoreplace text:
Input, UserInput, R, {enter}, btw,by the way,otoh,on the other hand |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Fri May 07, 2004 9:44 pm Post subject: |
|
|
then there should be a cmd like 'IsLabel, SomeLabel'
(setting errorlevel or outputvar)
so that if the label doesn't exist then script doesn't give an error and quit.
| Code: | AutoReplace, btw, by the way
Input, UserInput, R, {enter}, btw,by the way,otoh,on the other hand |
i think instead of the new cmd, the second usage will be better. no use splitting it into 2 cmds when input is quite sufficient. though the script i posted (or some variant) is quite enough, but 'R' can be a worthy addition.
btw wudn't this be better (both readable and intuitive)
| Code: | | Input, UserInput, R, {enter}, btw=by the way,otoh=on the other hand |
_________________
 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Fri May 07, 2004 10:00 pm Post subject: |
|
|
| Quote: | then there should be a cmd like 'IsLabel, SomeLabel'
(setting errorlevel or outputvar)
so that if the label doesn't exist then script doesn't give an error and quit. |
It's normal for an non-existent dynamic label to generate a runtime error. If there are some matches for which the user doesn't want a label, they should handle them beforehand, leaving only the valid labels for use with Gosub. In any case, the Gosub approach is of limited usefulness because it only works when the wildcard isn't in use.
| Quote: | btw wudn't this be better (both readable and intuitive)
btw=by the way,otoh=on the other hand |
Yes it seems better, thanks.
| Quote: | | i think instead of the new cmd, the second usage will be better. no use splitting it into 2 cmds when input is quite sufficient. |
Yeah... I think I see a problem now: I was hoping for auto-replace behavior that is in effect more globally. In other words, just the mere fact that the script is running should globally change typing behavior. Although this is easier to learn and maintain for the script writer, I wonder if enough people would use it to make it worthwhile.
Another dimension of ease of use might be to allow predefined hotstrings:
::btw::Send, {bs 3}by the way
It's so much easier to script them that way. But of course you give up some flexibility. |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Fri May 07, 2004 10:53 pm Post subject: |
|
|
| Code: | | ::btw::Send, {bs 3}by the way |
i still say just keep 'input' ...its enough for almost all needs. add 'R' if u feel adding ease for AutoReplace is necessary.
autoreplace wud've been justified if it'd also been case sensitive.
like
plz=please
Plz=Please
though maybe one can script this too ... maybe like this
input + case_commands + loop, parse _________________
 |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Fri May 07, 2004 11:28 pm Post subject: |
|
|
while testing the * feature i had the asterisk... dunno how it missed in the post. though the real problem was that i didn't use IfInString. _________________
 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Sat May 08, 2004 1:04 am Post subject: |
|
|
| Quote: | autoreplace wud've been justified if it'd also been case sensitive.
like
plz=please
Plz=Please |
By keeping the input matchlist insensitive and then turning on StringCaseSense, you can do this already (that's probably what you meant):
| Code: | Input, UserInput, , , plz
StringCaseSense, on
if UserInput = plz
Send, please
else if UserInput = Plz
Send, Please |
I should probably document that. |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Sat May 08, 2004 1:20 am Post subject: |
|
|
| Quote: | | By keeping the input matchlist insensitive and then turning on StringCaseSense, you can do this already I think. I should probably document that. |
actually i meant smart recognition, like one'll only define 'btw=by the way'... and it will do 'By the way' for 'Btw' by itself.... u might remember that this was something that You mentioned in one of ur mails quite some time ago while conceptualising this cmd. _________________
 |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|