| View previous topic :: View next topic |
| Author |
Message |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
Posted: Sun Jan 23, 2005 12:43 pm Post subject: hotstring4me - speed up the process of adding a hotstring |
|
|
I like to speed up the process of adding a new hotstring (auto-replace). Also I wish to suggest a very easy way to add new hotstrings to "normal users".
I'm not a programmer. Please regard my wish as a suggestion.
May be someone likes to realize the idea
The sketch:
(Edited: The suggestion is uploaded as
http://borumat.de/autohotkey-issues.php#hotstring4me )
Lets assume that a file "global-hotstrings.ahk" exists, which collects all the global hotstrings. User marks a string, e.g.:
by the way
this was typed
by autohotkey
Linebreaks are allowed
1 User marks a string in a text
2 User opens the script "hotstring4me.ahk" with the hotkey Ctrl+Alt+Shif+T. A dialog with one field, one text and two buttons opens
* Field:
[by the way] Hotstring
(the first 10 characters of the string are shown and they are selected)
* Text:
Automatically typed Text:
by the way
this was typed
by autohotkey
*Button: OK
*Button: Esc
3 User edits the hotstring as he likes
4 User presses Enter
Result: a new global hotstring has been inserted with just 4 steps at all into the file "global-hotstrings.ahk". And: The user has not been bothered with any decisions which are not relevant for him in this situation. If possible, the content of the clipboard will not be touched.
Background of my idea: Many years ago on my first computer, a second hand Mac powerbook, I used a tool called "TypeIt4me". This tiny smart auto-replace-tool offers almost a function like I described above. I never saw anythink smart for a windows-OS.
I'm quite impressed of AHK and I like to suggest it as auto-replace-tool for the mail-client thunderbird (and of course as a global auto-replace-tool) on my pages with the tip-collections (see my sig). _________________ Andreas
http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)
Last edited by Andreas Borutta on Mon Jan 24, 2005 2:11 am; edited 2 times in total |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sun Jan 23, 2005 1:23 pm Post subject: |
|
|
Currently, there aren't too many more manual steps involved: the user could select text as you describe, press Ctrl-C to copy it (I know you said it shouldn't use the clipboard), and then right click the tray icon to edit the script. Inside, the user would type the abbreviation between pairs of colons, followed by Ctrl-V to paste the desired string.
However, I see why your idea would be useful to heavy users of hotstrings because they could press a hotkey to bring up a dialog that instantly adds the chosen hotstring to their current script. Here is an example that does exactly that:
Edit: Improved the example. It can now be found at the bottom of the hotstrings page.
Last edited by Chris on Mon Jan 24, 2005 6:28 pm; edited 2 times in total |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
Posted: Sun Jan 23, 2005 1:55 pm Post subject: |
|
|
| Chris wrote: |
However, I see why your idea would be useful to heavy users of hotstrings because they could press a hotkey to bring up a dialog that instantly adds the chosen hotstring to their current script. [Script] |
Thank you for your example script and - thank you for your very impressing software
Let me explain why I regard the described features of "hotstring4me" as important.
1 Target group
These are people who write a lot, e.g. journalist or netizens
2 Keep content of clipboard
Of course that is not absolutely essential but smart of course I look for a smart "hotstring4me"
May be the user still has something important in his clipboard but suddenly, while typing he thinks "Hey, this string should be hotstringed".
3 Target file
I think it is good to use one central file to keep all global hotstrings. To mix up hotkeyscripts (here for the dialog) may make it more difficult to keep the overview about hotstrings
4 No "{Enter}"
The user should be free of the effort to insert "{Enter}" by hand when his replaced text contains linebreaks
5 No mouse
People who write a lot prefer the usage of the keyboard. They don't like to avoid to change to the mouse while typing because it consumes their time.
The target of the script really is: as few steps as possible
To your script:
The dialogfield keeps blank (apart from the four colons)
This doesn't change if the string is just marked or copied into the clipboard. _________________ Andreas
http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german) |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Sun Jan 23, 2005 3:35 pm Post subject: |
|
|
| Andreas Borutta wrote: | 2 Keep content of clipboard
Of course that is not absolutely essential but smart of course I look for a smart "hotstring4me"
The dialogfield keeps blank (apart from the four colons)
This doesn't change if the string is just marked or copied into the clipboard. | The example I posted retains the clipboard and it works in Notepad. I know it will not work in more elaborate editors such as word processors and I see only one way to solve that: by saving and restoring the clipboard's contents. However, AutoHotkey cannot save clipboard formats other than plain text so this would be of limited usefulness.
| Quote: | | May be the user still has something important in his clipboard but suddenly, while typing he thinks "Hey, this string should be hotstringed". | That's a good point and is reason enough to add the example above to the hotstrings section. Also, I have changed it to use the clipboard because "ControlGet Selected" is known to be non-functional when used against most control types other than Edit controls. It saves and restores the current text on the clipboard, which will not work exactly right when the clipboard contains something that isn't plain text. But it seems better than nothing.
| Quote: | | I think it is good to use one central file to keep all global hotstrings. To mix up hotkeyscripts (here for the dialog) may make it more difficult to keep the overview about hotstrings | Thanks. I'll keep "centrally managed hotstrings" in mind as a future feature.
| Quote: | | The user should be free of the effort to insert "{Enter}" by hand when his replaced text contains linebreaks | Good idea. I modified the script above to replace linebreaks with {Enter}.
Finally, I've added the script above to the bottom of the hotstrings page and credited you with the idea (if you'd rather not have your name shown here, please let me know).
Thanks for your suggestions, which have already made hotstrings better. |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Jan 23, 2005 5:35 pm Post subject: |
|
|
| Quote: | | However, AutoHotkey cannot save clipboard formats other than plain text so this would be of limited usefulness. |
That is a strong reason to give up this feature for the "hotstring4me".
IMHO it is better to guarantee the result "clipboard is not touched" completly or not at all. Than the user has transparency.
| Quote: | | Thanks. I'll keep "centrally managed hotstrings" in mind as a future feature. |
Fine.
I will post some other suggestions regarding hotstringing soon.
| Quote: | | Quote: | | The user should be free of the effort to insert "{Enter}" by hand when his replaced text contains linebreaks | Good idea. I modified the script above to replace linebreaks with {Enter}. |
Thank you.
| Quote: | | Finally, I've added the script above to the bottom of the hotstrings page and credited you with the idea |
Thank you for this.
Yout wrote "Andreas Borutta suggested the following script".
But the credits for the script is yours
May be you like to link instead just to the complete sketch:
http://borumat.de/autohotkey-issues.php#hotstring4me
| Quote: | | Thanks for your suggestions, which have already made hotstrings better. |
The author of the article in the german magazin "c't" where I read about your software is true: you are a really engaged and helpful author.
I wish that autohotkey will have a lot of satisfied users.
To the new script:
Now the selected string is inserted into the dialog.
I entered a hotstring, pressed OK.
Result:
"Error at line 33
This line does not contain a recognized action" |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Jan 23, 2005 6:21 pm Post subject: |
|
|
@ Andreas
| Quote: | | The author of the article in the german magazin "c't" where I read about your software is true: you are a really engaged and helpful author. | in welcher Ausgabe der c't wurde AHK wie oben zitert erwähnt ? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Mon Jan 24, 2005 6:27 pm Post subject: |
|
|
| Quote: | | IMHO it is better to guarantee the result "clipboard is not touched" completly or not at all. Than the user has transparency. | That is a good point but would defeat much of the usefulness of the script. I'll leave those lines in for now. Anyone can remove them if they prefer not to use the clipboard.
| Quote: | Yout wrote "Andreas Borutta suggested the following script".
But the credits for the script is yours  | In this case, I think your original idea is much more valuable than the script
| Quote: | A profile will be created automatically: [application data]\autohotkey\
It contains
scripts\global-hotstrings.ahk
autohotkey.ini | I will keep that in mind for a future version. Thanks.
| Quote: | Long hotstrings with linebreaks ({Enter}) are difficult to read and to edit.
A hotstring in the following form will be allowed, next to the old form:
::adr::
Andreas Borutta
Hochkirchstr. 8
10829 Berlin
::imho::in my humble opinion | A line continuation mechanism is planned. I will try to ensure that it works with hotstrings too.
| Quote: | "Local hotstrings" by a leading "[path to the application]"
All hotstrings after a line like [path to the application]up to the next start of such a "local group", will take effect only in the mentioned specific application. More than one application is allowed and will be separated with comma. | I think someone else suggested this too. It's a good idea and hopefully someday it will get implemented. In the meantime, there are some other posts on the forum about ways to make your hotstrings context sensitive.
| Quote: | | Syntaxhighlighting for Ultraedit | If Tekl or someone else wouldn't mind revising Tekl's UltraEdit script to use the master syntax files, that would be a great help.
That's a nice example. Currently, the script showcase is a less flexible method of doing this sort of thing. A wiki like that one might be a nice alternative someday.
| Quote: | | ::btw::by the way, an example{Enter}with a semicolon `;and - even -{Enter}some text in {{}braces{}} | I changed the script to use "send raw" mode. It should handle special characters better now, though in exchange, `n is now used in place of {Enter}, which might be harder to read.
| Quote: | Error at line 33
This line does not contain a recognized action | I added a little more validation to the script at the bottom of the hotstrings page. If you get a chance, perhaps you could try it again.
Thanks for everything. |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
Posted: Mon Jan 24, 2005 7:24 pm Post subject: |
|
|
I just snip the parts, which are clear.
Thank your statements, which features you regard as interesting and plan to implement them.
| Quote: | | Quote: | | "Local hotstrings" |
It's a good idea and hopefully someday it will get implemented. In the meantime, there are some other posts on the forum about ways to make your hotstrings context sensitive. |
What do you think about the idea to place the method onto
http://www.autohotkey.com/docs/Hotstrings.htm
In my eyes it seems to be something very essentially.
| Quote: | | Quote: | | ::btw::by the way, an example{Enter}with a semicolon `;and - even -{Enter}some text in {{}braces{}} | I changed the script to use "send raw" mode. It should handle special characters better now, though in exchange, `n is now used in place of {Enter}, which might be harder to read. |
Hhm. When the user has a proper syntaxhighlighting, that's fine.
But may be I couldn't see what other disadvantages the raw mode has.
Why isn't it the default mode?
[script]
I tried it again.
I works almost.
First I got the message "The hotstring just added appears to be improperly formatted."
I found the reason.
The hotstring has been added directly next to the "return".
This causes the error message.
Then I tested a selected text over several lines.
The hotstring looks like expected:
:R:test::one`two`nthree
But when I trigger "test" in an email I just get:
one
The linebreaks are not "printed".
| Quote: | | Thanks for everything. |
I thank you.  _________________ Andreas
http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german) |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Jan 25, 2005 2:55 am Post subject: |
|
|
Thanks; I will do that.
| Quote: | | But may be I couldn't see what other disadvantages the raw mode has. Why isn't it the default mode? | It was thought that users would be used to the syntax of the Send command, and thus find it easier to use {Enter} instead of `r, etc. But in hindsight, it might have been a little better to have "raw" as the default. In any case, I don't think it should be changed now since it would break a lot of existing scripts.
| Quote: | | The hotstring has been added directly next to the "return". | Thanks. I fixed that in the script by providing an extra line break before the hotstring.
| Quote: | The hotstring looks like expected:
:R:test::one`two`nthree
But when I trigger "test" in an email I just get:
one
The linebreaks are not "printed". | I think that has been fixed in the script by using `r instead of `n. Please let me know if you spot any other problems with it. |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
Posted: Tue Jan 25, 2005 10:36 am Post subject: |
|
|
| Quote: | | Thanks; I will do that. |
Nice. Would you mind to give me a short email, when this happened?
How to realize local hotstrings is the last information I need to suggest and explain autohotkey for hotstringing to the readers of the thunderbird-tipcollection.
| Quote: | | Quote: | | But may be I couldn't see what other disadvantages the raw mode has. Why isn't it the default mode? | It was thought that users would be used to the syntax of the Send command, and thus find it easier to use {Enter} instead of `r, etc. But in hindsight, it might have been a little better to have "raw" as the default. In any case, I don't think it should be changed now since it would break a lot of existing scripts. |
I understand.
BTW: How could one escape these "commands" inside a raw hotstring.
And: Could one sent a "Shift+Enter" inside a raw hotstring? This may be important in textprocessing because one wants a linebreak but not a new paragraph.
| Quote: | | Quote: | | The linebreaks are not "printed". | I think that has been fixed in the script by using `r instead of `n. Please let me know if you spot any other problems with it. |
Now it works fine
Even with `n. Strange but true. _________________ Andreas
http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german) |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Jan 25, 2005 1:07 pm Post subject: |
|
|
| Andreas Borutta wrote: | | Would you mind to give me a short email, when this happened? | No problem.
| Quote: | | How could one escape these "commands" inside a raw hotstring. | If a hotstring is raw, things like {Enter} are always sent literally. There is no way to change that once the raw mode is in effect for a particular hotstring. However, to mix raw and non-raw within the same hotstring, you could do something like this:
::btw::
Send By the way:{Enter}
SendRaw All of the following will be sent exactly as they appear: ^!#{Enter}
return
| Quote: | | Could one sent a "Shift+Enter" inside a raw hotstring? This may be important in textprocessing because one wants a linebreak but not a new paragraph. | In raw mode, shift-enter might be equivalent to sending `n instead of a `r. In non-raw mode, you can use +{Enter} to send shift-enter. |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
Posted: Tue Jan 25, 2005 1:46 pm Post subject: |
|
|
| Quote: | | Quote: | | How could one escape these "commands" inside a raw hotstring. | If a hotstring is raw, things like {Enter} are always sent literally. There is no way to change that once the raw mode is in effect for a particular hotstring. |
I meant "`r" with "commands". These strings aren't sent literally in the raw mode. How could you sent them literally,while you are in the raw mode?
Example: Somebody adds a Text like
| Code: | | This is a command in AHK: `r |
with the hotstring4me script.
| Quote: | | Quote: | | Could one sent a "Shift+Enter" inside a raw hotstring? This may be important in textprocessing because one wants a linebreak but not a new paragraph. | In raw mode, shift-enter might be equivalent to sending `n instead of a `r. |
I tested it in Openoffice.
| Code: | | :R:test::one`rtwo`nthree |
The "`n" seems to performs a "Ctrl+Enter", means - a page-break.
In the non-raw-mode
| Code: | | ::test::one+{Enter}two+{Enter}three |
works fine and adds linebreaks and not a new paragraph. _________________ Andreas
http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german) |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Jan 25, 2005 2:45 pm Post subject: |
|
|
| Andreas Borutta wrote: | | I meant "`r" with "commands". These strings aren't sent literally in the raw mode. How could you sent them literally,while you are in the raw mode? | That's a good point. A literal accent is sent by specifying two consecutive accents. I've fixed this in the script by adding the following line:
StringReplace, Hotstring, Clipboard, ``, ````, All ; Do this replacement first to avoid interfering with the others below.
Thanks for posting your findings about Shift-Enter and Ctrl-Enter. |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
|
| Back to top |
|
 |
|