The request is - if the above format is put into a plain text file, and/or the same format but no spaces before or after the equal sign, can someone make a script that would put them all into an AHK hotstrings file? I would like it so that somehow, before importing the list, the user could specify whether they want the trigger key to be the spacebar, the semicolon key, or whatever other key they choose.

I think the following code should solve your problem.I've tested it and it seems to be working It only has one limitation.The text to be replaced cannot end with a space, and the text to replace cannot start with a space, or you'll need to add that space to trigger the hotstring.i.e. the text file accepts the following format:hthym=hypothyroidismtpptth=the patient presented to the hospital

Oh, and another thing: the hotstrings cannot have '=' in it These two issues can be solved if you really need them.Here's the code:

#SingleInstance,Force;filetoread contains the name of the file to readfiletoread=textfile.txt;file to write contains the name of the file to writefiletowrite=hotstringsScript.ahk;to add a trigger, put it after the '='.please notice that colons have to be added like this: `, trigger=

That is incredible! I'm awe-struck. This is just tremendous for me! I suspected it might be easy for some of you and fast, but wow, you whipped it up immediately!

Not being able to have the equal sign in a hotstring should not be any problem at all. None. Nor the space issue.

I tried it on a very large text file (35 pages worth of phrases when I opened it with MS Word), and it took them beautifully. And fast. If a person has duplicate short forms, the resulting Hotstrings file won't run until they are taken out or changed. I think, right now, that is fine. Let the person deal with those. Maybe I'll think on that.

I don't need an executable, this is fine. This is okay to share with other MTs?

Wow, can't get over it. Is it terribly much a whole 'nuther ballgame (difficulty-wise) to make them have tooltips, such that when you hit your short form keys (tpptth) you'd get a tooltip showing you the matching phrase? I'm just asking here, I know it wasn't in my original request. I may make a new post with such a request!

Well, I have more playing to do. I feel really appreciative. You probably can have no idea, LOL. Thank you, jgpaiva! Great job!

No problem with sharing, please do. (But some publicity for DC would be nice )

Wow, can't get over it. Is it terribly much a whole 'nuther ballgame (difficulty-wise) to make them have tooltips, such that when you hit your short form keys (tpptth) you'd get a tooltip showing you the matching phrase?

if you type tpptth, the hotstring would not be replaced but there would appear a tooltip?or do you mean if you type tpp, the possible completions would appear?The first one is easy to do. The second one, could be impossible (at least with my knowledge )

BTW, this other script might intrest you: http://www.autohotke...viewtopic.php?t=2066It's a hotstring manager, gui-like.It is defined to look in a file named "HotString_Defs.ahk" for hotstrings, and then add them to a gui. When you press ctrl + alt + A, it opens a manager where you can delete hotstrings and add new hotstrings.Looks good

Believe me, DC will definitely be getting publicity. As a matter of fact, they would have been anyway. I'm so taken away with this place, it is a wonderful site. I'm only waiting until I'm a bit more familiar here, so that when I say what I have to say, I do it well. Your programming this for me only shoots my opinion up about 90% higher!

About the duplicate short forms, I meant if someone has:

mar25=March 25mar25=0.25% Marcaine

Then, when you click on the Hotstrings script, it tells you there is a duplicate, the program won't run, and will exit. As I said, that's really no big deal. They can take them out manually.

If, for example, with tpptth=the patient presented to the hospital, one types tpptth, I would want it still to replace the hotstring, but show a tooltip of the phrase. Your second example of possible completions would be incredible, beautiful. That is what some popular expanders do now. However, I am very happy at the moment. Very! Please feel more than free to stop here. I'm wowed enough for one day.

#SingleInstance,Force;filetoread contains the name of the file to readfiletoread=textfile.txt;file to write contains the name of the file to writefiletowrite=hotstringsScript.ahk;to add a trigger, put it after the '='.please notice that colons have to be added like this: `, trigger=;the time for the display of the tooltip (in milliseconds)TooltipTime=1000

(notice you can change the tooltip display time)The repeated entries checker can be done, but possibly it'd make more sense as another script.The tooltip with the completions of the hotstring would have to be presented at autohotkey.com or to DC's ahk expert, Skrommel

#singleinstance,force;filetoread contains the name of the file to readfiletoread=textfile.txt;file to write contains the name of the file to writefiletowrite=hotstringsScript.ahk;to add a trigger, put it after the '='.please notice that colons have to be added like this: `, trigger=;the time for the display of the tooltip (in milliseconds)TooltipTime=1000

MsgBox,4,Show Gui?,Do you want to use the gui interface?,30000IfMsgBox,Yes GoSub,MostraGuiIfMsgBox,No GoSub,SemGuireturn

You can change all the paramters and hit [enter] (or the create file! button), and it will generate the hotstrings file.If you change the file to read, you might want to reload the hotstrings list, that's what the "reload" button is for.(notice that to disable the tooltip, you can just set the time to '0', and it won't appear )

What can I say about the GUI, I love it! We all love them so, don't we? <grin> Thank you, this is near perfect now.

One thing....the two later scripts put the trigger before the actual short form. So for instance, with the latest one with the great place for putting in your trigger key and the create file button, if I put in a semicolon for the trigger and hit create file, then the hotstrings come out with the trigger before the short form. For instance:

Oh, I can change it so easily with a find and replace that it's no biggee, but I would like to change it in the script itself. I'm not sure how to do this, can you help me?

Lastly, I adore the tool tip! I've even seen in the past how to do certain things with tooltips, such as center them, etc. But, is it feasible to have the tool tip show before you hit the trigger key (the semicolon)?

Oops.. Sorry, I understood that trigger key would be the key before the hotstring.No problems.It is now modified, with the Trigger key at the end, and the tooltip appears before you hit the trigger. If you don't hit it for 3 seconds, or don't hit it at all, it isn't replaced.

Instructions:This is the new gui:On the left, there is the list of the several hotstrings located on the file listed under "file to read".This uses a listview, which means you can list the hotstrings by name if you think there are some repeated ones (although probably tomorrow i'll do a version that checks for that ).

"Create File!" button, immediatelly creates the new hotstrings file, using the options that are displayed.

Trigger editbox let's you choose which trigger to use. Leaving it blank means there is no trigger and the hotstrings are used right after you write them.

Time for the tooltip edit box lets you choose the time you want the tooltip to be displayed, for every hotstring.

File to write editbox has the name of the file to write. This can be either a relative to the location of the script path, or an absolute path.

File to read editbox has the name of the file to read. This can be either a relative to the location of the script path, or an absolute path.

The "Reload" button makes the gui be reloaded with the new options, which basically means that the listview will display the hotstrings from the "file to read" edit box, in case you've changed it.You don't have to reload to apply the "file to read" option, you can change it and click "create file!", but the listview will only be updated if the reload button is pressed.

If the trigger method is used, the generated hotsrings script will be case-sensitive. Please check this post for more information!

All the default configurations can be changed in the source file, in the variables at the beggining of the code, as in prior versions.

Selecting the non-gui version will use the default values, and closing the gui will cancel the creation of the new file.

Well, Harrie.. In attachment is what looks like the last funcional and complete version of this script.Notice that it's more recent than the one I sent you through e-mail for testing. Now, I fixed the gui (the listview didn't come all the way down, and some buttons weren't aligned) and reused some code to reduce the file size (and general confusion ).I also made another script, that allows you to check a file for repeated entries of a string.This other script, although functional, doesn't tell you how many times the string is repeated and might preform *very* slowly with big files

Grr.. Why? But oh why??I'm so inattentive, it's unbelievable.I've updated the post above with the functioning version.(Now it prevents the overwrite of the "filetowrite", and prompts you before deleting it for writing.)I hope it doesn't have errors now

Alternative suggestion for finding duplicate triggers: maybe something like a simple AWK script that takes the first "word," i.e. the trigger, up to but excluding the "=" sign. Pass output through SORT and some version of UNIQ/UNIQUE with -d option to show duplicate triggers? Something like this;

trigger.awk--------------BEGIN { FS = "="}{ print $1 }---------------

awk -f trigger.awk filetoread.txt | sort | uniq -d

if filetoread.txt is

afmq=aftermarketavq=availableavq=availabilitybawq=black-and-white

the only output you get is

avq

Leaving out the AWK script would show you completely duplicated lines.

Next suggestion - documentation

Harrie;

How do you remember that many shorthand triggers?

Have you looked at freeware Speed Typing and shareware Type Pilot from Two Pilots http://www.colorpilot.com/typepilot.html ? In fact you would need the shareware version to import/export phrases, so you might be better off with AHK.

A good place to start is Eric Pement's Web site http://www.student.n...du/pemente/index.htmFollow the AWK link (by the way, if you follow his SED link and keep paging down, you get to an excellent summary of text search-and-replace tools, though that's not relevant here)

Yet another update.Today I had some free time, so I tested thoroughlly the script, and found out that the earlier versions didn't behave correctlly. When the person didn't put the trigger after writing the hotstring, the string would still be deleted. That didn't make sense.So, this is the last version.I tested it as much as I could, and everything looks right.Now, it stores the options chosen in the last execution in one ini file, checks for the existance of the file it's about to write, I have fixed one issue with the trigger time, and now if you don't press the trigger key, the string isn't replaced.I just hope this is the last *fix* update I have to do. Sorry, but please download the latest version from the post above.

Ah! The final version is a lot better, in fact! I too had noticed, after my last post, that there was a bit of funny behavior. Actually, I didn't mind the string being deleted so much (it would also disappear before hitting the trigger, so to speak), but if there was atl=at this level , then, when trying to type something like atlanta, you couldn't actually do it without hitting the end key or something, there was interference. That's gone now. I am very happy. Please consider this the last "fix." I ended up asking for (and getting!) more than I had originally intended. This looks really, really good. I'm deeply grateful for the work put into it, jgpaiva.

rjbull, thanks for your input. (Not to claim that I understand the language part, you understand). Do I actually remember them all? No way. That's why I use what to me, is the best expander out there. It's called Instant Text. It has incredible abilities, such as coming up with continuations of your phrases, and a whole lot more. Maybe I'll talk about it in a separate post at some time, since this is a place for software talk. But I'm not that sure I know all the rules and ins and outs of DC yet. Anyway, I don't have to remember. It has visuals. Different from tooltips, but visuals. Also, we try to have "systems" for our phrases. That's a huge help, too. Might be more than you want to know, though!

Anyway, I and others I know have had a large interest in AHK for a long time, and the issue of importing so many abbreviations is so big to us, and this script is just so fantastic. There are features galore transcriptionists like to have, but I personally would never have gotten anywhere near this point, no way. And it's just very exciting to me. Having the tooltips thrown in is a joy, pure joy.

Yep, everything seems to be right now. Good to know that! Just a few notes about the "trigger" field:- to have the word be immediatelly replaced after you write it, add no trigger.- to have a space as trigger, put Space in the "trigger" field.- to have a tab as trigger, put Tab in the "trigger" field.- to have a comma (,) as trigger, put `, in the "trigger" field.- tiggers like LWin (for the left windows key) or LCtrl (for the left ctrl), can also be used. For a complete list of the possible trigger keys, check http://www.autohotke...com/docs/KeyList.htm Most of the keys featured at this list should work as triggers.

(BTW, did you try the repeated entries search on that huge file you have? I'm curious if it works in an acceptable time.)Oh, and another thing: With the latest version of ahk, you don't get the "repeated hotstrings" error, it simply uses the last hotstring found on the file. So, be carefull as the script might work, but some of the hotstrings can be ignored if you don't check for repeated entries first.

Repeated Entries worked like a charm! On that text file which was 35 pages in MS Word (in small font size, mind you), it found them. I didn't time it, but I'd say 2 minutes, maybe. I knew to wait, and then it popped up a message box telling me that the following strings were repeated (and listed them).

It is wonderful to have all those trigger choices! Tomorrow, I think I'm going to check each one of them out, definitely the most common ones people might choose. I had it in my mind one couldn't choose space. I personally wouldn't want to use space, but others might. These options just make it more cool.

this might be a good chance to remind people that when you see a little green $ next to someone's name (like the one next to jgpaiva's name) you can make a donation to them if you want to thank them for help or for coding something, etc.

by supporting those who help out and contribute to the site, we will make the site a more useful place for everyone, and ensure that it continues to improve. remember that your donations are not just rewards for work well done, but think of it as funding continued furture work and support.

The first program I ever learnt - I started in late 1988 - was a mid-period version of the best DOS shareware word processor, PC-Write. I still use a later version today. PC-Write has what it calls "shorthand expansion," which is very like AHK hotstrings, though naturally limited to the program. It's easy to remember ones I use frequently, but not so the rare ones, and there were times when I wanted a point-and-shoot means of adding boilerplate text. In my case, that's normally short phrases, words I often mis-spell, and bibliographic references so I get them in consistent format. I never found a freeware or shareware one, and didn't discover commercial medical transcription text expanders until far too late. In retrospect I could probably have used the DOS macro program Newkey in earlier days, but it doesn't work very well in a Windows DOS box.

Recently, I find that under Windows2000 at least, AHK hotstrings work even in a DOS box (which is now an emulation apparently, not "real" DOS). It isn't perfect if you insist on using DOS programs, but it does mean I can port the relevant bits of my shorthand expansion file into AHK to make it available to other programs, both DOS and Windows. This is a great convenience, or it will be when I get round to doing it, but I'd still like a point-and-press pop-up so I can access less frequently-used phrases. Hence, I'd certainly be interested to hear about Instant Text, when you a moment.

As for the "language bit," it seemed a pity for jgpaiva to build a new tool when (with a small amount of augmentation) ones already exist to do the job, and might even be faster on big files. However, as an old-tyme DOS hand, that's just the way I'm used to working.