AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Prevent hotstring duplicates
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Andreas Borutta



Joined: 23 Jan 2005
Posts: 47

PostPosted: Tue Jan 25, 2005 11:50 am    Post subject: Prevent hotstring duplicates Reply with quote

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
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Jan 25, 2005 2:48 pm    Post subject: Reply with quote

I don't think I understand... what is the "hotstringlist?"
Back to top
View user's profile Send private message
Andreas Borutta



Joined: 23 Jan 2005
Posts: 47

PostPosted: Tue Jan 25, 2005 6:36 pm    Post subject: Reply with quote

jonny wrote:
I don't think I understand... what is the "hotstringlist?"

In my understanding the following is one single hotstring
Code:
::btw::by the way

This is a list of two hotstrings
Code:
::btw::by the way
::imho::in my humble opinion

A larger list (of german hotstrings) you find on:
http://borumat.de/autohotkey-makro-und-autokorrektur-tipps.php#autokorrekturliste
http://borumat.de/autohotkey/globale-autokorrektur.ahk

That is also the background for my question.

I like to collect more hotstrings to offer them to others. Inevitable it will come to duplicates. It would be nice to have an effective tool to eliminate them.

To the vocabulary:
May be you, Chris, could give a comment to this?
Code:
:o:btw::by the way

How to you like to label all the parts of this "thing"?

Parameter, trigger, output, rule, hotstring, hotstringlist ...
Is hotstring the whole thing, is the trigger of the example ":o:btw::" or just "btw"?

An example of a presentation of vocabulary:
http://borumat.de/html-und-css-tipps.php#vokabular-verweise
_________________
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
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Jan 25, 2005 8:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
Andreas Borutta



Joined: 23 Jan 2005
Posts: 47

PostPosted: Tue Jan 25, 2005 9:10 pm    Post subject: Reply with quote

jonny wrote:
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.

Thank you for trying it. Smile

Well, I have no idea at all which tool is suitable for this task.

May be these powerful editors of you programmers (vim, emacs, ...) contain such a script?
May be it is possible to do it with regular expression?
Don't know.
_________________
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
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Jan 25, 2005 11:27 pm    Post subject: Reply with quote

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 "Surprised:btw::" or just "btw"?
"btw" might be called the abbreviation (or trigger). The "o" is part of this hotstring's "options".
Back to top
View user's profile Send private message Send e-mail
Andreas Borutta



Joined: 23 Jan 2005
Posts: 47

PostPosted: Wed Jan 26, 2005 9:59 am    Post subject: Reply with quote

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 "Surprised: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
View user's profile Send private message
BoBo
Guest





PostPosted: Wed Jan 26, 2005 11:27 am    Post subject: Reply with quote

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





PostPosted: Wed Jan 26, 2005 12:09 pm    Post subject: Reply with quote

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. Rolling Eyes Tweak it! Wink
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Wed Jan 26, 2005 1:24 pm    Post subject: Reply with quote

BoBo has a really good point. To check for a duplicate, type the name and an ending character. Wink
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Wed Jan 26, 2005 1:30 pm    Post subject: Reply with quote

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.

Quote:
What do you think of the idea to define the vocabulary on http://autohotkey.com/docs/Hotstrings.htm ?
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.

Quote:
Is the following correct?
http://borumat.de/autohotkey-makro-und-autokorrektur-tipps.php#vokabular
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
View user's profile Send private message Send e-mail
Andreas Borutta



Joined: 23 Jan 2005
Posts: 47

PostPosted: Wed Jan 26, 2005 4:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
Andreas Borutta



Joined: 23 Jan 2005
Posts: 47

PostPosted: Wed Jan 26, 2005 4:36 pm    Post subject: Reply with quote

@bobo
Please could you explain in some simple words, what your scripts do - in comparison to the "original" on
http://autohotkey.com/docs/Hotstrings.htm

Thanks.
_________________
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 Thu Jan 27, 2005 2:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
Tekl



Joined: 24 Sep 2004
Posts: 813
Location: Germany

PostPosted: Thu Jan 27, 2005 1:12 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Andreas Borutta



Joined: 23 Jan 2005
Posts: 47

PostPosted: Thu Jan 27, 2005 2:22 pm    Post subject: Reply with quote

Quote:
some text-editors can remove duplicates with the sort-command (ultraedit

Yes, I know.
But the sort command of ultraedit doesn't interprete
::btw::by the way
and
::btw::between
as duplicates.

Quote:
also AHK can remove duplicates with its sort-command.

Could you give an example to me, please.
_________________
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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group