Code: Select all
#NoEnv
#SingleInstance force
; send the corrected word on reload (will replace the selected word)
if(%0% > 1)
Send, %2%
; a tiny GUI setup
Gui, Add, Edit, vfrom w300 ,%Hotstring%::
Gui, Add, Edit, vto w300 ym0,%Hotstring%
Gui, Add, Button, Default, OK
#h::
AutoTrim Off
ClipboardOld = %ClipboardAll%
Clipboard =
Send ^c
ClipWait 1
if ErrorLevel
return
StringReplace, Hotstring, Clipboard, ``, ````, All
StringReplace, Hotstring, Hotstring, `r`n, ``r, All
StringReplace, Hotstring, Hotstring, `n, ``r, All
StringReplace, Hotstring, Hotstring, %A_Tab%, ``t, All
StringReplace, Hotstring, Hotstring, `;, ```;, All
; trim the word (better imo)
Hotstring := Trim(Hotstring)
Clipboard = %ClipboardOld%
; setting the hotstrings in the GUI
GuiControl,, to, %Hotstring%
GuiControl,, from, %Hotstring%::
; focus to the "to" gui
GuiControl, Focus, to
Gui, Show
; send control + a in order toselecctthe text in the "to" gui (better imo)
Send, ^a
return
; happens when pressing the OK button
ButtonOK:
; assembling the hotstring and save it to this file
GuiControlGet, to
GuiControlGet, from
Hotstring := "::" from to
FileAppend, `n%Hotstring%, %A_ScriptFullPath%
; special reload statement with the word in the "to" gui
Run, %A_ScriptFullPath% /restart %to%
Sleep 200
MsgBox, 4,, The hotstring just added appears to be improperly formatted. Would you like to open the script for editing? Note that the bad hotstring is at the bottom of the script.
IfMsgBox, Yes, Edit
return
Anyone who knows what could cause this and how I could remedy it? Thanks.