Yesterday I was trying to write up a quick AutoHotkey script to quickly dump in a Fusedoc snippet into my files.
I was tearing my hair out (I don’t have much left!) because I kept getting extraneous characters printing out after the script ran. After quite a bit of trial and error it finally dawned on me what was happening.
I was using SendInput in AutoHotkey to print out characters and when running this in Eclipse the autocomplete was kicking in! So if I entered “<” it would throw in “>”. I tested this by running the same script in Notepad and it printed out fine.
I was a bit stumped but someone on the AutoHotkey forum suggested using the clipboard instead!! This morning I tinkered a bit and rewrote my script to instead append everything to the clipboard and then paste it.
First we need to setup our clipboard:
clipboard =
That was easy :) Now we can simply append items to it. The `r`n is a line break.
clipboard = %clipboard% <!--- `r`n
clipboard = %clipboard% <fusedoc fuse="%currentFile%" language="ColdFusion" specification="2.0">`r`n
clipboard = %clipboard% <responsibilities>%fuseDocResponsibility%</responsibilities>`r`n
...
Then finally we can dump it back to the screen by doing a CTRL+V:
...
clipboard = %clipboard% ---> `r`n
send ^v
By using the clipboard this pastes as one item into Eclipse and bypasses the autocomplete! The full script is below:
:*:;fd::
FormatTime, TimeString, ShortDate
SetKeyDelay, 20 ;in millisceonds
InputBox, fuseDocResponsibility, Attribute Prompt, Responsibility..., , 300, 150
If ErrorLevel = 1 ; They clicked cancel
return
Sleep, 100
clipboard =
clipboard = %clipboard% <!--- `r`n
clipboard = %clipboard% <fusedoc fuse="" language="ColdFusion" specification="2.0">`r`n
clipboard = %clipboard% <responsibilities>%fuseDocResponsibility%</responsibilities>`r`n
clipboard = %clipboard% <properties>`r`n
clipboard = %clipboard% <history type="Create" author="Jim Priest" comments="" date="%TimeString%" role="Developer" email="priestj@my.work.email"></history>`r`n
clipboard = %clipboard% </properties>`r`n
clipboard = %clipboard% <io>`r`n
clipboard = %clipboard% <in></in>`r`n
clipboard = %clipboard% <out></out>`r`n
clipboard = %clipboard% </io>`r`n
clipboard = %clipboard% `r`n
clipboard = %clipboard% ---> `r`n
send ^v
return