Authotkey and Eclipse Autocomplete
Friday 8 January 2010 - Filed under Code
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% `r`n clipboard = %clipboard% %fuseDocResponsibility%`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% `r`n clipboard = %clipboard% %fuseDocResponsibility%`r`n clipboard = %clipboard% `r`n clipboard = %clipboard% `r`n clipboard = %clipboard% `r`n clipboard = %clipboard% `r`n clipboard = %clipboard% `r`n clipboard = %clipboard% `r`n clipboard = %clipboard% `r`n clipboard = %clipboard% `r`n clipboard = %clipboard% ---> `r`n send ^v return
2010-01-08 » Jim Priest