Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

New command: Input (for hotstrings and auto-replace)


  • Please log in to reply
12 replies to this topic
Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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.autohotke...mands/Input.htm

And here is the special installer that contains this interim version of the program:
http://home.tampabay... ... -input.exe

Since this is a fairly major feature, following Rajat's wisdom and getting feedback, improvements, and corrections prior to release seems best.

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
Installed and testing with different scripts. Everything looks good so far. Thanks again for another great addition to AutoHotkey.

thanks,
beardboy

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
I've checked the new command....wow! ...very impressive! :p

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?

*: Wildcard

some example script on this plz! ...i'd tested typing '[abtw' but that didn't work... maybe its used some other way.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

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.

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?

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
~]::
	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! :)

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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:
~]:: 
   Input, UserInput, *VT3L5, {tab}, btw,otoh 
   SetKeyDelay, -1 
   IfInString UserInput, btw
      Send, {backspace 4}by the way 
return


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
Gosub, %UserInput%

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.

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)
Input, UserInput, R, {enter}, btw=by the way,otoh=on the other hand

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

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.

btw wudn't this be better (both readable and intuitive)
btw=by the way,otoh=on the other hand

Yes it seems better, thanks.

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.

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
::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

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
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.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

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):
Input, UserInput, , , plz
StringCaseSense, on
if UserInput = plz
     Send, please
else if UserInput = Plz
     Send, Please
I should probably document that.

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004

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.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat