Is this the latest version?:
; PhraseOMatic - by DaTex
; This script displays a popup menu of text to insert into the
; current application window at the cursor position
; The user-editable text file also contains program settings such as
; the Menu title, the Windows Tray Icon, and the ToolTip
; See http://www.autohotkey.net/~DaTex/PhraseOMatic/
; for changelog and feature description
SetBatchLines, 10ms
#SingleInstance force
#Persistent
#WinActivateForce
#NoEnv
HasRegistry=1 ;Presume the registry keys exist
RegRead, PhraseFile, HKEY_CURRENT_USER, Software\PhraseOMatic
IfEqual, Errorlevel, 1
{
HasRegistry=0
PhraseFile=%A_ScriptDir%\PhraseOMatic.txt
}
SplitPath, PhraseFile,,f_PhrasePath
;_____ Defaults _____
InHeader=1
InSubmenu=0
TheCatName=
CurrentMenu=PhraseMenu
ThisTitle = *-= {Click} or {Enter} inserts, with {Shift} -> clipboard =-*
ThisToolTip = PhraseOMatic v1.1.0 (F6)
ThisIcon = 47
;_____ Load file into Popup Menu____________
IfExist, %PhraseFile%
{
Loop, Read, %PhraseFile%
{
If InHeader
{
If RegExMatch(A_LoopReadLine, "^;MenuTitle:(.+)", menutitle)
ThisTitle = %menutitle1%
Else If RegExMatch(A_LoopReadLine, "^;ToolTip:(.+)", pom_tooltip)
ThisToolTip = %pom_tooltip1%
Else If RegExMatch(A_LoopReadLine, "^;Shell32.dll Icon:(.+)", pom_icon)
ThisIcon = %pom_icon1%
Else If RegExMatch(A_LoopReadLine, "^;<----")
{ ;Process Header Data and Exit Header Code
InHeader = 0
Menu, %CurrentMenu%, Add, %ThisTitle%, MenuDummy
Menu, %CurrentMenu%, Add ;Separator between title and phrases
Menu, Tray, Tip, %ThisToolTip%
Menu, Tray, Icon, Shell32.dll, %ThisIcon%
Continue
}
Else If RegExMatch(A_LoopReadLine,"^;")
Continue
Else If A_LoopReadLine ; not blank
{ ;Process Header Data, Exit Header, and fall through to parse line
InHeader = 0
Menu, %CurrentMenu%, Add, %ThisTitle%, MenuDummy
Menu, %CurrentMenu%, Add ;Separator between title and phrases
Menu, Tray, Tip, %ThisToolTip%
Menu, Tray, Icon, Shell32.dll, %ThisIcon%
}
}
If RegExMatch(A_LoopReadLine, "^-")
{
Menu, %CurrentMenu%, Add
} Else If RegExMatch(A_LoopReadLine,"^;")
{ ;Do nothing - comment line
} Else If RegExMatch(A_LoopReadLine,"^/")
{
CurrentMenu=PhraseMenu
Menu, %CurrentMenu%, Add, %TheCatName%, :%TheCatName%
InSubmenu=0
} Else If RegExMatch(A_LoopReadLine,"^>(.*)", comment)
{ ;Non-selectable Menu item (visible comment)
StringReplace, phrase, comment1, &, &&, All
Menu, %CurrentMenu%, Add, %phrase%, MenuDummy
} Else If RegExMatch(A_LoopReadLine,"^@([A-Za-z0-9]+)", para)
{ ;Paraphrase: @abc Long Text will display abc but insert 'Long Text'
Menu, %CurrentMenu%, Add, @%para1%, MenuPara
%para1% := Trim(SubStr(A_LoopReadLine,InStr(A_LoopReadLine," ")+1))
} Else If RegExMatch(A_LoopReadLine,"^\[(.+)\]",catname)
{ ; Category Name is saved as TheCatName since catname1 is overwritten
StringReplace, TheCatName, catname1, &, &&, All
CurrentMenu=%TheCatName%
InSubmenu=1
} Else If A_LoopReadLine ; not blank
{
StringReplace, phrase, A_LoopReadLine, &, &&, All
Menu, %CurrentMenu%, Add, %phrase%, MenuClick
}
}
} Else
MsgBox, 16, PhraseOMatic, Cannot find %PhraseFile%
Menu, tray, add ; Creates a separator line.
Menu, tray, add, Create File..., MenuCreateFile
Menu, tray, add, Add File..., MenuAddFile
Menu, tray, add, Remove File..., MenuRemoveFile
Menu, tray, add ; Creates a separator line.
IfEqual, HasRegistry, 1
{
Loop, HKCU, Software\PhraseOMatic,1,0
{
If A_LoopRegName
{
Menu, tray, add, %A_LoopRegName%, MenuSetDefault
RegRead, f_MenuPhrasePath
IfEqual, f_MenuPhrasePath, %PhraseFile%
Menu, tray, check, %A_LoopRegName%
}
}
Menu, tray, add ; Creates a separator line.
}
Shortcut = %A_Startup%\Shortcut to PhraseOMatic.lnk
Menu, tray, add, Create Shortcut in Startup Folder, MenuCreateShortcut
IfExist %Shortcut%
Menu, tray, Disable, Create Shortcut in Startup Folder
Menu, tray, add, Edit Phrases, MenuNotepad
Menu, tray, Default, Edit Phrases
Menu, tray, add, Path: %f_PhrasePath%, MenuGoPath
Return
;_____Hotkey and Label Section_____
~F6::
Menu, PhraseMenu, Show
Return
MenuCreateShortcut:
FileCreateShortcut, %A_ScriptFullPath%, %Shortcut%
Reload
Return
MenuAddFile:
FileSelectFile, AddedFile, 3, %f_PhrasePath%, Select Phrase File, PhraseOMatic Text Files (*.txt)
IfExist, %AddedFile%
{
InputBox, AddedName, Name This PhraseOMatic File, Provide a brief (1- or 2- word) name for this file,,,,,,,,Added PhraseFile
RegWrite,REG_SZ, HKCU, Software\PhraseOMatic, %AddedName%, %AddedFile%
RegWrite,REG_SZ, HKCU, Software\PhraseOMatic,, %AddedFile%
MsgBox,,%AddedName% Added,The Phrasefile %AddedName% is now the default.`nUse the right-click menu on the tray icon to change.
Reload
}
Return
MenuCreateFile:
InputBox, CreatedName, Name This PhraseOMatic File, Provide a brief (1- or 2- word) name for this new file,,,,,,,,New PhraseFile
FileSelectFile, CreatedFile, S24, %f_PhrasePath%, Create Phrase File, PhraseOMatic Text Files (*.txt)
FileAppend,
(
;MenuTitle:PhraseOMatic - %CreatedName%
;ToolTip:PhraseOMatic 1.1.0 (F6)
;Shell32.dll Icon:47
; Certain first characters on a line have special meaning:
; [] Encloses a Submenu Name, e.g., [Companies]
; / Ends a Submenu Block
; - Inserts a Separator Line
; ; Comment (non-displaying)
; > Comment (displays but does nothing if clicked)
; @term Definition displays @term but inserts Definition
;<---- Add / Edit Text Items Below This Line ---->
>PhraseOMatic Sample Text
>Double-click the tray icon to edit this file
),%CreatedFile%
MsgBox,64,Created File,Save and Close Notepad after Adding Data
RunWait, Notepad.exe %CreatedFile%
RegWrite,REG_SZ, HKCU, Software\PhraseOMatic, %CreatedName%, %CreatedFile%
RegWrite,REG_SZ, HKCU, Software\PhraseOMatic,, %CreatedFile%
MsgBox,64,%CreatedName% Created,The Phrasefile %CreatedName% is now the default.`nUse the right-click menu on the tray icon to change.
Reload
Return
MenuRemoveFile:
Gui, Add, Text,, Select the PhraseFile name to remove from the menu`n(note you cannot delete the currently active Phrase File). `nThis does not delete any files from the disk drive.`nTo cancel, press ESCAPE or close this window.
Gui, Add, ListBox, vMyListBox gMyListBox w240 r10
Gui, Add, Button, Default, OK
Loop, HKCU, Software\PhraseOMatic,1,0
{
If A_LoopRegName ;I think this will not list the active Phrase File in the list box to be deleted
{
RegRead, f_MenuPhrasePath
IfNotEqual, f_MenuPhrasePath, %PhraseFile%
GuiControl,, MyListBox, %A_LoopRegName%
}
}
Gui, Show
Return
MenuNotepad:
RunWait, Notepad.exe %PhraseFile%
Reload
Return
MenuGoPath:
Run, Explorer.exe %f_PhrasePath%,,Max
Return
MenuSetDefault:
Loop, HKCU, Software\PhraseOMatic,1,0
{
IfEqual, A_LoopRegName, %A_ThisMenuItem%
{
RegRead, f_MenuPhrasePath
RegWrite, REG_SZ, HKCU, Software\PhraseOMatic,, %f_MenuPhrasePath%
Break
}
}
Reload
Return
MenuDummy:
Return
MenuClick:
; Replace double ampersand (&&) with single again
StringReplace, phrase, A_ThisMenuItem, &&, &, All
MenuClick2:
GetKeyState, state, Shift
IfEqual,state,D
Clipboard = %phrase%
Else
{
WinActivate
Loop, Parse, phrase, %A_Space%
SendInput, {Raw}%A_LoopField%%A_Space%
}
GetKeyState, state, Ctrl
IfEqual,state,D
Menu, PhraseMenu, Show
Return
MenuPara:
; Reset the stored value of the paraphrase variable
Tmp1 := SubStr(A_ThisMenuItem,2)
Tmp := %Tmp1%
StringReplace, phrase, Tmp, &&, &, All
Gosub, MenuClick2
Return
MyListBox:
If A_GuiEvent <> DoubleClick
return
; Otherwise, the user double-clicked a list item, so treat that the same as pressing OK.
; So fall through to the next label.
ButtonOK:
GuiControlGet, MyListBox ; Retrieve the ListBox's current selection.
MsgBox, 4,, Would you you like to remove %MyListBox%?
IfMsgBox, No
{
Gui, Destroy
Return
}
RegDelete, HKCU, Software\PhraseOMatic, %MyListBox%
MsgBox,64,Removed PhraseFile,The Phrasefile %MyListBox% was removed.
Gui, Destroy
Reload
Return
GuiClose:
GuiEscape:
Gui, Destroy
return