 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
Posted: Tue Jan 25, 2005 11:50 am Post subject: Prevent hotstring duplicates |
|
|
An idea for a script:
To ease the care of the hotstringlist, duplicates will be deleted automatically, when the upper and lower cases do not differ. When just differences in upper and lower cases exist, a dialog will appear and the user could decide if the duplicate should be deleted.
What do you think of this?
Does anyone like to create such a script? _________________ 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 Tue Jan 25, 2005 6:15 pm; edited 1 time in total |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Jan 25, 2005 2:48 pm Post subject: |
|
|
| I don't think I understand... what is the "hotstringlist?" |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Jan 25, 2005 8:55 pm Post subject: |
|
|
| Sorry, I experimented and wasn't able to find an efficient way to do it. Perhaps AutoHotkey's the wrong tool in this case. You could try a text searching utility. |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Jan 25, 2005 11:27 pm Post subject: |
|
|
| Andreas Borutta wrote: | | Inevitable it will come to duplicates. It would be nice to have an effective tool to eliminate them. | Although primitive, one approach would be scan the entire hotstrings file(s) with file-reading loops, building a master list of all hotstrings. After that, you can sort the list, then scan it with a parsing loop to report which abbreviations are duplicates.
If this sounds like something you want to do but you can't determine how to write the script, someone here can help you.
| Quote: | Parameter, trigger, output, rule, hotstring, hotstringlist ...
Is hotstring the whole thing, is the trigger of the example " :btw::" or just "btw"? | "btw" might be called the abbreviation (or trigger). The "o" is part of this hotstring's "options". |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
Posted: Wed Jan 26, 2005 9:59 am Post subject: |
|
|
| Quote: | | Quote: | | Inevitable it will come to duplicates. It would be nice to have an effective tool to eliminate them. | Although primitive, one approach would be scan the entire hotstrings file(s) with file-reading loops, building a master list of all hotstrings. After that, you can sort the list, then scan it with a parsing loop to report which abbreviations are duplicates.
If this sounds like something you want to do but you can't determine how to write the script, someone here can help you.
|
Thank you for this suggestion.
If I have the luck that someone likes the idea and will write a script for this it will happen.
I myself am completly unexperienced in programming and this area does not count as my talent so I don't plan to go into it.
I like to "produce" some ideas. Sometimes programmers like them and take them as inspiration.
What I discovered: May the searched function exists, in the basics, already?
When you start a hotstringlist which contains one trigger more than once, you get a message box.
The hotstringlist will not be reloaded. Note: the autoreload function is inserted into the hotstringlist
http://borumat.de/autohotkey-makro-und-autokorrektur-tipps.php#skript-automatisch-neu-laden
Interesting could be: the line in which the duplikate could be find is given out in a message box.
May be this function allows to build an elegant "PreventDuplicates" script.
One can distinguish two situations:
1 A hotstringlist is edited in an editor an than it will be reloaded by the user manually
2 A single hotstring is added to a hotstringlist by "hotstring4me"
My suggestion for a little improvement for your script hotstring4me:
The messagebox of hotstring4me reacts to the try to enter a trigger more than once and the messagebox to add the hotstring will be reopened - with the trigger selected and a message like "Please use another trigger, the one you entered already exists".
What do think of this idea?
| Quote: | | Quote: | Parameter, trigger, output, rule, hotstring, hotstringlist ...
Is hotstring the whole thing, is the trigger of the example " :btw::" or just "btw"? | "btw" might be called the abbreviation (or trigger). The "o" is part of this hotstring's "options". |
What do you think of the idea to define the vocabulary on http://autohotkey.com/docs/Hotstrings.htm ?
In my experience clear terms are always useful in communication.
Is the following correct?
http://borumat.de/autohotkey-makro-und-autokorrektur-tipps.php#vokabular _________________ 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 |
|
 |
BoBo Guest
|
Posted: Wed Jan 26, 2005 11:27 am Post subject: |
|
|
| If hotstring4me is active a requested Hotstring (via the keyboard) would definitely be obvious cause it would be replaced a sec later with the existing assignment, isn't it ? |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Wed Jan 26, 2005 12:09 pm Post subject: |
|
|
HotString.ahk
| Code: | ; mfg,wkr,otoh,jj,ds6
::mfg::Mit freundlichen Grüßen
::wkr::With kind regards
::otoh::on the other hand
::jj::sag noch einmal "Ja,Ja" und es setzt was!
::ds6::Danke. Setzen. Sechs!
!F9::Run HotstringCreator.ahk ; Press ALT+F9 to create a new hotstring above |
HotStringCreator.ahk
| Code: |
CreateHotString:
InputBox, IVar, HotStringCreator, Please enter the new HotString you wanna create`nSample`n`nahkr = AutoHotkey rulez!
If ERRORLEVEL = 1
ExitApp
CheckHotString:
StringSplit, Field, Ivar, =
If Field0 = 1
{
MsgBox, You've missed to use --> =`nto split the abbreviation from its replacement !
Goto, CreateHotString
}
If Field2 =
{
MsgBox, Not possible to create a hotstring`nwithout defining a replacement !
Goto, CreateHotString
}
FileReadLine, ExistingHotString, HotString.ahk, 1
StringTrimLeft, ExistingHotString, ExistingHotString, 1
If Field1 contains %ExistingHotString%
{
InputBox, IVar, HotStringCreator, HotString: %Field1% already exists!`nPlease choose another one.
Goto, CreateHotString
}
Else
ExistingHotString = %ExistingHotString%`,%Field1%`n`n`::%Field1%`::%Field2%
Loop, Read, HotString.ahk, HotString.tmp
{
If A_Index = 1
{
FileAppend, `; %ExistingHotString%
Continue
}
FileAppend, %A_LoopReadLine%`n
}
|
Havn't checked an AutoReload of HotString.ahk. Tweak it!  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Wed Jan 26, 2005 1:24 pm Post subject: |
|
|
BoBo has a really good point. To check for a duplicate, type the name and an ending character.  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Wed Jan 26, 2005 1:30 pm Post subject: |
|
|
Thanks BoBo.
| Andreas Borutta wrote: | | If I have the luck that someone likes the idea and will write a script for this it will happen. | I think overall that the problem of dupliate hotstrings is too uncommon to worry about. If it does happen, the program will usually warn you with the following message: | Quote: | Error at line 3.
Line Text: ::abc
Error: This label has been defined more than once. |
Even if it doesn't detect the duplicate due to it being slightly different in options yet functionally identical to another, hotstrings are designed so that only the first matching hotstring will be triggered. When you type such an abbreviation and see that it triggers your older hotstring, it will be obvious that you have a duplicate (as Jonny said).
| Quote: | My suggestion for a little improvement for your script hotstring4me:
The messagebox of hotstring4me reacts to the try to enter a trigger more than once and the messagebox to add the hotstring will be reopened - with the trigger selected and a message like "Please use another trigger, the one you entered already exists".
What do think of this idea? | I think it would be good in a few cases, but for a typical user it seems too rare a problem to justify making that already-long script even longer.
I wanted to keep the hotstring page in laymen's terms. I don't think the typical user would see much benefit in learning a strict vocabulary for the parts of a hotstring.
| Quote: | | In my experience clear terms are always useful in communication. | Among professional users and developers of hotstrings, yes. But I think it would be too distracting for casual users, who are in the majority.
That vocabulary seems okay but I find the following a little clearer:
abbreviation: btw
options: o, r, etc. (the letters in between the first two colons)
replacement: the text after the last pair of colons
Your terminology is fine too. "Trigger" might be more meaningful to some.
Thanks again for all your feedback about hotstrings. There are quite a few improvements planned for the future, most of which are thanks to you and others who have posted insightful ideas. |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
Posted: Wed Jan 26, 2005 4:34 pm Post subject: |
|
|
| Quote: | | Even if it doesn't detect the duplicate due to it being slightly different in options yet functionally identical to another, hotstrings are designed so that only the first matching hotstring will be triggered. When you type such an abbreviation and see that it triggers your older hotstring |
May be the user is awake enough to see it. In fact in many times the user will find an "unexpected result". Of course he himself is responsible.
Well, but in my opinion it the task of smart tools to ease the process of taking care - in this case - of a huge hotstringlist.
Of course I respect your view, that may be not so many users will have troubles with triggers which exist more often than once. In my view preserving the user from operating mistakes it is typical task of applications/ tools/ skripts/ ...
Thank you for all your statements. _________________ 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 |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
|
| Back to top |
|
 |
Tekl
Joined: 24 Sep 2004 Posts: 813 Location: Germany
|
Posted: Thu Jan 27, 2005 1:12 pm Post subject: |
|
|
Hi,
i haven't read all, but some text-editors can remove duplicates with the sort-command (ultraedit, editplus) and also AHK can remove duplicates with its sort-command.
Tekl |
|
| Back to top |
|
 |
Andreas Borutta
Joined: 23 Jan 2005 Posts: 47
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|