This is yet another version of the script, now with a gui.
Hope you like it!
#singleinstance,force
;filetoread contains the name of the file to read
filetoread=textfile.txt
;file to write contains the name of the file to write
filetowrite=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?,30000
IfMsgBox,Yes
GoSub,MostraGui
IfMsgBox,No
GoSub,SemGui
return
MostraGui:
Gui, Add, ListView,gLstView x9 y5 w240 h230 , Trigger String|Result String
GoSub,UpdateListView
Gui, Add, Button,gCreateFile +default x259 y-1 w65 h23 , &Create File!
Gui, Add, Text, x259 y28 w36 h13 , Trigger:
Gui, Add, Edit,vtrigger x259 y47 w120 h21 , %trigger%
Gui, Add, Text, x259 y74 w90 h13 , Time for the tooltip:
Gui, Add, Edit,vtooltiptime x259 y93 w33 h21 ,%tooltiptime%
Gui, Add, Text, x259 y120 w59 h13 , File to Write:
Gui, Add, Edit, x259 y139 w102 h21 vfiletowrite,%filetowrite%
Gui, Add, Text, x259 y166 w60 h13 , File to Read:
Gui, Add, Edit, x259 y185 w53 h21 vfiletoread,%filetoread%
Gui, Add, Button,gReadFile x259 y212 w63 h23 , &Reload
Gui, Show,,
Return
ReadFile:
Gui,Submit
Gui,Destroy
GoSub,MostraGui
return
SemGui:
loop,Read,%filetoread%,
{
string=%A_LoopReadLine%
StringSplit,result,string,=,
replaceable:=result1
replaced:=result2
FileAppend,:o*:%trigger%%replaceable%::`nSend`,%replaced%`nTooltip`,%replaced%`nSleep`,%tooltiptime%`nTooltip`,`nreturn`n`n,%filetowrite%
}
return
CreateFile:
Gui,Submit
loop,Read,%filetoread%,
{
string=%A_LoopReadLine%
StringSplit,result,string,=,
replaceable:=result1
replaced:=result2
FileAppend,:o*:%trigger%%replaceable%::`nSend`,%replaced%`nTooltip`,%replaced%`nSleep`,%tooltiptime%`nTooltip`,`nreturn`n`n,%filetowrite%
}
exitapp
return
LstView:
return
UpdateListView:
loop,Read,%filetoread%,
{
string=%A_LoopReadLine%
StringSplit,result,string,=,
LV_Add("",result1,result2)
}
return
GuiClose:
Gui,Destroy
Tooltip,File Creation Canceled
sleep,%TooltipTime%
Tooltip
ExitApp
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
)