Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

AutoReplace & AutoComplete


  • Please log in to reply
8 replies to this topic
nemroth
  • Guests
  • Last active:
  • Joined: --
I'd like to see in AutoHotkey (superb programm !!!!), two inbuilt new commands

1) a first new command witch can be for example
AutoHKReplace, Start, IniFile, Section
where 'Start' should be the character to be typed before the abreviation
'IniFile' the name of the INI file
'Section' the name of the section in the INI File
where there is for example "iyp=if you please" (with the possibility to put functions keys {F6}, +{F7},... , numpad keys and other control keys used in the Send command {Space}, {End}.....)
If the start key is ² (in a french keyboard}, the key sequence "²iyp" would be replaced by "if you please"
This new command would give the ability to choose the selection key and should be easier to use than the scripts I seen on the forum, even if they work (I haven't tested them yet)
A unique command is far better than a group of command...

2) In the same spirit, a command like
AutoHKComplete, IniFile, Section (for example)
would allow, when typing to the keyboard, to have a list of possible completion strings to be displayed and to be able to choose beetween them.

I hope this suggestions will become new commands for AutoHotkey.

Nemroth

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Those are creative ideas, thanks. I do want to add some simpler "hot string" features. Having an INI file might be a more user friendly way to maintain a list of auto-replace phrases. Your auto-complete idea is nice as well, though the fact that it probably requires a new window will mean quite a bit of development work.

Realistically, it's going to be at least a few more weeks before more hot-string features are added. In the meantime, you might want to try out the Input command to see if that inspires any more ideas about improvements.

Most of AHK's new features, especially complex things such as hot-strings, come from ideas like yours.

nemroth
  • Guests
  • Last active:
  • Joined: --
Hi cmallett (& others of course),

Just to complete the first idea, the command should be :

AutoHKReplace, Start, IniFile, Section, timeout

Because if you have for example a shortcut
cc
and another
cca

I think it's necessary to have a timeout to let the computer decide if you typed only 'cc'

I think the idea of the INI file comes because it is very easy to create and maintain.

I will try the Input command, but when I seen it in the help, (a few seconds ago...),
I think it would be usefull too to implement the control structure Case to avoid too many else if

For example

case UserInput
= btw
Send, {backspace 4}by the way
= otoh
Send, {backspace 5}on the other hand
= fl
Send, {backspace 3}Florida
= ca
Send, {backspace 3}California
= ahk
Run, www.autohotkey.com
End Case

For example...

The Case structure control could handle other test on conditions
=, <>, <, >, <=, =>

To come back to the "AutoHKReplace" command, the {backspace x} would be handled internaly...

Thanks for your attention to our suggestions...

Again thanks for this beautifull work. I'm a beginner in C++ programming and I will study you code to try to understand it, slowly. Thanks to give it to the community of the Open Source...

Nemroth

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
AutoReplace wasn't deemed a high priority by most people I spoke with, which is why there isn't yet a built-in feature for that.

Thanks for all these ideas, which I've made a note of and will come back to when I work on hotstrings again.

nemroth
  • Guests
  • Last active:
  • Joined: --
Hi everybody,

I'm glad to see that my proposition of an autoreplace command is, in the list of the planned features, in the first ones (I don't know if they are in the order in witch they will be added, but...).

Built in support for auto-replace and easy-to-define hot strings, e.g. ::btw::Send, by the way. It should have built-in support for capitalization, a set of punctuation, and other things so that recognition is smart/selective

Just two little more suggestion :

1) Is it possible, alternatively to the Send command, to have the possiblity to put a label name or a command Goto, Label to call the code of this label ?
For example :
::btw::Label or ::btw::Goto, Label

Label:
	clipboard =
	Send, ^a^c
	ClipWait
	IfNotInString, clipboard, Something
             Send, by the way
         Else 
             Send,  something else

2) The second idea is to have the option to give a timeout, for the programm to be able to distinguish beetween, for example :

::ml::Send, My Lady
and
::mll::Send, My Lady and my Lord

Again thanks for this very powerfull programm and to put it in Open Source. Fantastic work !!!

Thanks by advance

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Your #1 suggestion is definitely planned. Hot strings should be able to trigger any command, including Gosub.

Your #2 suggestion is intriguing. My original intent was not to support long hot strings that have shorter ones contained entirely inside them. But rather than have a timeout as you suggest, I think the plan to have it use "smart punctuation" will already handle this.

For example, if you type a hot string such as "ML", that will not be enough by itself because it's too vague. The plan is to require (by default, anyway) that hot strings be ended by a terminating character such as space, tab, comma, period, etc. This set of stop chars and punctuation will be configurable. There will also be an option to launch without requiring a stop char, which is intended for strings that are unique enough not to need it. e.g. if it's some nonsense word or special acronym that never occurs inside other words and thus is non-ambiguous.

In light of the above, can you think of any examples that would still require the timeout feature you described?

Thanks for sharing your insight.

Nemroth
  • Guests
  • Last active:
  • Joined: --
OK.

If I understand well what you plane to do, is to have a termination key and not an activation key. For me it's OK, so "ML" & "MLL" are not the same for the program.

For the moment, to have an autoreplace facility, I use AllChars (when the facility will be launched, I will keep only autoHoteky, of course...). AllChars need and activation key and so, if the activation key is "*", for example, *ML and *MLL must be distinguished, and so a timeout is necessary.

In your command there will be ML* and MLL*, for example, whitch not need any timeout to be distinguished.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
I want to support lead keys (as the Input command does currently) and end keys. I want it to be flexible enough to handle just about any hot string behavior you can envision. So the more ideas I get here, the better. I have also been looking at other software to get a feel for their capabilities.

Nemroth
  • Guests
  • Last active:
  • Joined: --
For me, if it will possible to have only either a begin or an end key or both, it's OK. I'd like to have the choice.
But if there is only an activation key, I think it can be usefull to have a timeout to avoid confusion beetween possibles shortcut.
But it is not the case...