I've been frustrated for a long time by the inability to quickly re-order templates in the template list, and by the inability to go into the Te* files and make changes (they're some kind of binary mixed in with ASCII).
In any case, I found a way to post to the template list and move templates up and down rather quickly with this AHK script (to use it go to autohotkey.com and download the program)
- Code: Select all
SetTitleMatchMode,Regex
GetProcAddress(dll, funcname) {
return DllCall("GetProcAddress", UInt, DllCall("GetModuleHandle", Str, dll) ,Str, funcname)
}
LB_GetCurrentSelection(hWnd) {
global SendMessageProc
LB_GETCURSEL := 0x188
SendMessageProc := GetProcAddress("user32", "SendMessageA")
Return DllCall(SendMessageProc, UInt, hWnd, UInt, LB_GETCURSEL, UInt, 0, UInt, 0)
}
postRightClick()
{
LB_GETITEMRECT := 0x198
; GET THE WINDOW HANDLE FOR MY CONTROL (LIST BOX 5 IN THIS CASE IN ULTRAEDIT; THE TEMPLATE LIST)
ControlGet, LBhwnd, Hwnd,, ListBox5, A
; GET CURRENT POSITION OF LISTBOX -----------------------------
WinGetPos, X, Y, , , ahk_id %LBhwnd%
; GET CURRENT ITEM ID -----------------------------------------
i := LB_GetCurrentSelection( LBHwnd)
; GET THE Y COORDINATE OF THE SELECTED ITEM (I) ---------------
VarSetCapacity( yatl_rect, 16 )
DllCall( "SendMessage", UInt, LBHwnd, UInt, LB_GETITEMRECT, UInt, i, UInt, &yatl_rect )
yatl_rect_y := NumGet( yatl_rect, 4, Int )
; SET THE X VALUE ABOUT 50 PX IN TO MAKE SURE IT HITS AN ITEM (THIS WILL VARY BY APPLICATION)
cX:=50
cY:=yatl_rect_y
; SEND THE RIGHT CLICK MESSAGE (0X204) ENCODING THE X AND Y COORDINATES ON THE CONTROL TO CLICK
PostMessage, 0x204, 0x8 | 0x1, cX & 0xFFFF | (cY & 0xFFFF) << 16,, ahk_id %LBhwnd%
}
F6::
postRightClick()
ControlSend, ListBox5, {Down 2}{Enter},A
Return
F7::
postRightClick()
ControlSend, ListBox5, {Down 3}{Enter},A
Return


