I have created a GUI script based on an older script I found here. It is basically a list of all my hotkeys from all my scripts, since I cant remember them all.
I have almost completed the scipt but I encountered two problems which I cant resolve:
1.Whenever I click one of the tabs from the top row of the tabbar, the top row swaps with the bottom row.
I dont want that, I want the tabs to remain in the same position they appear to be, whenever I start the script and run the GUI.
Here is an example:
Before i click tab in top row
After I clicked it
Ιf I click one of the tabs from the top row, the top row becomes bottom. the same will happen again if I click another tab from the top row.
I only want all the tabs to have the same position like in the first photo.
2.How can I make the active tab colorized with the blue color (its background, border, whatever is possible), so it is distinguishable from the others tabs? I want only the tab part with the text tile, not the entire listview/window.
something like this:
Script's code. i am also attaching the file.
Code: Select all
;#Warn
#NoEnv
#Persistent
#SingleInstance Force
DetectHiddenWindows, On
SetTitleMatchMode, 2
SendMode, Input
;============================================================;
;============================================================;
;HOTKEYS LIST OF ALL SCRIPTS
;============================================================;
;Open Hotkeys List
F1::
MODIFIED=20140605
;- Listview >>> ADD_NEW / MODIFY / DELETE / SEARCH
MainWindowTitle=Hotkeys
transform,T,chr,09
delim = `,
first1:=0
gosub,test1 ;-- create 2 text-files for 2 ListViews ( test )
Gui,2:default
Gui,2: Font,CDefault,Fixedsys
Gui,2: Margin, 10, 10
Tabnumber:=1
gui,2:add, Tab2, x10 y10 w580 h128 gtabchange vTabnumber AltSubmit, Manager|Organizer|Positions|Software|Windows|Hearthstone|Overwatch|Heroes of the Storm
gui,2:tab, Manager
gui,2:add, listview,x10 y55 w580 h500 grid cWhite backgroundteal hwndLV1 vLV1 gListViewEvents +altsubmit -multi, Keys|AHK|Function
gosub,fill1
gosub,width1
;Gui,2:add,button, x10 y450 gPrintLV1,Print
Gui,2:Add, Button, x10 y570 w100 vaddnew1 gAddNew1,ADD NEW
Gui,2:Add, Edit, x140 y570 w300 gFind vSrch1,
Gui,2:Add, Button, x470 y570 w100 vexitgui1 gexitgui, EXIT
gui,2:tab, Organizer
gui,2:add, listview,x10 y55 w580 h500 grid cWhite backgroundteal hwndLV2 vLV2 gListViewEvents +altsubmit -multi, Keys|AHK|Function
gosub,fill2
gosub,width1
;Gui,2:add,button, x10 y450 gPrintLV1,Print
Gui,2:Add, Button, x10 y570 w100 vaddnew2 gAddNew1,ADD NEW
Gui,2:Add, Edit, x140 y570 w300 gFind vSrch2,
Gui,2:Add, Button, x470 y570 w100 vexitgui2 gexitgui, EXIT
gui,2:tab, Positions
gui,2:add, listview,x10 y55 w580 h500 grid cWhite backgroundteal hwndLV3 vLV3 gListViewEvents +altsubmit -multi, Keys|AHK|Function
gosub,fill3
gosub,width1
;Gui,2:add,button, x10 y450 gPrintLV1,Print
Gui,2:Add, Button, x10 y570 w100 vaddnew3 gAddNew1,ADD NEW
Gui,2:Add, Edit, x140 y570 w300 gFind vSrch3,
Gui,2:Add, Button, x470 y570 w100 vexitgui3 gexitgui, EXIT
gui,2:tab, Software
gui,2:add, listview,x10 y55 w580 h500 grid cWhite backgroundteal hwndLV4 vLV4 gListViewEvents +altsubmit -multi, Keys|AHK|Function
gosub,fill4
gosub,width1
;Gui,2:add,button, x10 y450 gPrintLV1,Print
Gui,2:Add, Button, x10 y570 w100 vaddnew4 gAddNew1,ADD NEW
Gui,2:Add, Edit, x140 y570 w300 gFind vSrch4,
Gui,2:Add, Button, x470 y570 w100 vexitgui4 gexitgui, EXIT
gui,2:tab, Windows
gui,2:add, listview,x10 y55 w580 h500 grid cWhite backgroundteal hwndLV5 vLV5 gListViewEvents +altsubmit -multi, Keys|AHK|Function
gosub,fill5
gosub,width1
;Gui,2:add,button, x10 y450 gPrintLV1,Print
Gui,2:Add, Button, x10 y570 w100 vaddnew5 gAddNew1,ADD NEW
Gui,2:Add, Edit, x140 y570 w300 gFind vSrch5,
Gui,2:Add, Button, x470 y570 w100 vexitgui5 gexitgui, EXIT
gui,2:tab, Hearthstone
gui,2:add, listview,x10 y55 w580 h500 grid cWhite backgroundteal hwndLV6 vLV6 gListViewEvents +altsubmit -multi, Keys|AHK|Function
gosub,fill6
gosub,width1
;Gui,2:add,button, x10 y450 gPrintLV1,Print
Gui,2:Add, Button, x10 y570 w100 vaddnew6 gAddNew1,ADD NEW
Gui,2:Add, Edit, x140 y570 w300 gFind vSrch6,
Gui,2:Add, Button, x470 y570 w100 vexitgui6 gexitgui, EXIT
gui,2:tab, Overwatch
gui,2:add, listview,x10 y55 w580 h500 grid cWhite backgroundteal hwndLV7 vLV7 gListViewEvents +altsubmit -multi, Keys|AHK|Function
gosub,fill7
gosub,width1
;Gui,2:add,button, x10 y450 gPrintLV1,Print
Gui,2:Add, Button, x10 y570 w100 vaddnew7 gAddNew1,ADD NEW
Gui,2:Add, Edit, x140 y570 w300 gFind vSrch7,
Gui,2:Add, Button, x470 y570 w100 vexitgui7 gexitgui, EXIT
gui,2:tab, Heroes of the Storm
gui,2:add, listview,x10 y55 w580 h500 grid cWhite backgroundteal hwndLV8 vLV8 gListViewEvents +altsubmit -multi, Keys|AHK|Function
gosub,fill8
gosub,width1
;Gui,2:add,button, x10 y450 gPrintLV1,Print
Gui,2:Add, Button, x10 y570 w100 vaddnew8 gAddNew1,ADD NEW
Gui,2:Add, Edit, x140 y570 w300 gFind vSrch8,
Gui,2:Add, Button, x470 y570 w100 vexitgui8 gexitgui, EXIT
;to exit variable xreiazetai tin katalixi _TT gia na trexei to tooltip
exitgui1_TT := "Exit"
exitgui2_TT := "Exit"
exitgui3_TT := "Exit"
exitgui4_TT := "Exit"
exitgui5_TT := "Exit"
exitgui6_TT := "Exit"
exitgui7_TT := "Exit"
exitgui8_TT := "Exit"
addnew1_TT := "Add New"
addnew2_TT := "Add New"
addnew3_TT := "Add New"
addnew4_TT := "Add New"
addnew5_TT := "Add New"
addnew6_TT := "Add New"
addnew7_TT := "Add New"
addnew8_TT := "Add New"
OnMessage(0x200, "WM_MOUSEMOVE") ;show tooltip
gui,2: show, x980 y420 w600 h610, %MainWindowTitle%
gosub,tabchange
Return
;valtin os adeia "gnull" subroutine sta text boxes mono, gia na trexei to tooltip
null:
Return
2Guiclose:
2GuiEscape:
exitgui:
Gui, Destroy ;closes gui without exiting script
Return
width1:
T1=200
T2=76
T3=300
LV_ModifyCol(1,T1)
LV_ModifyCol(2,T2)
LV_ModifyCol(3,T3)
;LV_ModifyCol(2,"Integer")
Return
;-------------------------------------------------------------------------------------
tabchange:
GuiControlGet, Tabnumber
GuiControl,2:Focus,srch%tabnumber%
Return
;-------------------------------------------------------------------------------------
;---------------- SEARCH -------------------
Find:
Gui,2: Submit, Nohide
Gui,2:listview, LV%Tabnumber%
Fx=%A_WorkingDir%\Hotkeys%tabnumber%.txt
src:= % srch%Tabnumber%
if (SRC="")
{
goto,Fill%Tabnumber%
Return
}
LV_Delete()
loop,read,%fx%
{
LR=%A_loopReadLine%
if SRC<>
{
if LR contains %src%
{
stringsplit,C,A_LoopReadLine,%delim%
LV_Add("",C1,C2,C3)
}
}
else
continue
}
LV_Modify(LV_GetCount(), "Vis")
if (SRC="")
goto,Fill%Tabnumber%
Return
;------------------- LISTVIEW --------------
ListViewEvents:
Gui,2:default
Gui,2:listview, LV%Tabnumber%
if(A_GuiEvent == "Normal")
{
LV_GetText(C1, A_EventInfo, 1)
LV_GetText(C2, A_EventInfo, 2)
LV_GetText(C3, A_EventInfo, 3)
Clipboard := C1 " - " C2 " - " C3
}
if(A_GuiEvent == "DoubleClick")
{
LV_GetText(C2, A_EventInfo, 2)
Send % C2
/*
stringmid,url1,c2,1,7
stringmid,pth1,c2,2,2
if ((url1="http://") or (pth1=":\"))
run,%c2%
*/
Return
}
if(A_GuiEvent == "RightClick")
{
LV_GetText(C1, A_EventInfo, 1)
LV_GetText(C2, A_EventInfo, 2)
LV_GetText(C3, A_EventInfo, 3)
gosub,Modify1
Return
}
if A_GuiEvent=K
{
GetKeyState,state,DEL ;- << DELETE
if state=D
{
RowNumber:=LV_GetNext()
LV_Delete(RowNumber)
gosub,Modify2
Return
}
Return
}
Return
;--------------------------------------------------------------
;---------------- MODIFY ----------------
Modify1:
Gui,3: +AlwaysonTop
Gui,3: Font, s10, Verdana
gui, 3:listview, LV%Tabnumber%
Gui,3:add, edit, w300 h30 vC1, %C1%
Gui,3:add, edit, w300 h30 vC2, %C2%
Gui,3:add, edit, w300 h30 vC3, %C3%
Gui,3: Add,Button, x12 gACCEPT1 default, Accept
Gui,3: Add,Button, x+4 gCANCEL1, Cancel
Gui,3:show,center, Modify ;LV_Modify
Return
accept1:
Gui,2:default
Gui,3:submit,nohide
gui 3:listview, LV%Tabnumber%
RowNumber := LV_GetNext()
If ( RowNumber = 0 ) {
Gui,3:destroy
c1:=
c2:=
c3:=
MsgBox,,ERROR,You clicked an empty row
}
else {
c1:= % c1
c2:= % c2
c3:= % c3
lv_modify(rownumber, "col1" , C1 )
lv_modify(rownumber, "col2" , C2 )
lv_modify(rownumber, "col3" , C3 )
gosub,modify2
Gui,3:destroy
}
Return
cancel1:
3Guiclose:
Gui,3:destroy
Return
;-----------------------------------------------------------------
;---------------- ADD NEW ----------------
ADDNEW1:
Gui,4: +AlwaysonTop
Gui,4: Font, s10, Verdana
Gui,4:listview, LV%Tabnumber%
Gui,4:add, Text,, Keys
Gui,4:add, edit, w300 h30 vC1,
Gui,4:add, Text,, AHK
Gui,4:add, edit, w300 h30 vC2,
Gui,4:add, Text,, Function
Gui,4:add, edit, w300 h30 vC3,
Gui,4: Add,Button, x12 gACCEPT4 default, Accept
Gui,4: Add,Button, x+4 gCANCEL4, Cancel
Gui,4:show,center,Add New
Return
accept4:
Gui,2:default
Gui,4:submit,nohide
Gui,4:listview, LV%Tabnumber%
Fx=%A_WorkingDir%\Hotkeys%tabnumber%.txt
Fileappend,%c1%%delim%%c2%%delim%%c3%`r`n,%fx%
gosub,fill%tabnumber%
Gui,4:destroy
Return
cancel4:
4Guiclose:
Gui,4:destroy
Return
;-----------------------------------------------------------------
;------------------ FILL ----------------------------
Fill1:
gui,2:listview, listview%Tabnumber%
LV_Delete()
loop,read,%F1%
{
LR=%A_loopReadLine%
if LR=
continue
C1 =
C2 =
C3 =
stringsplit,C,LR,%delim%,
LV_Add("", c1,c2,c3)
}
LV_ModifyCol(1, "Sort CaseLocale") ; or "Sort CaseLocale"
LV_Modify(LV_GetCount(), "Vis") ;scrolls down
Return
Fill2:
gui, 2:listview, listview%Tabnumber%
LV_Delete()
loop,read,%F2%
{
LR=%A_loopReadLine%
if LR=
continue
C1 =
C2 =
C3 =
stringsplit,C,LR,%delim%,
LV_Add("", c1,c2,c3)
}
LV_ModifyCol(1, "Sort CaseLocale") ; or "Sort CaseLocale"
LV_Modify(LV_GetCount(), "Vis") ;scrolls down
Return
Fill3:
gui, 2:listview, listview%Tabnumber%
LV_Delete()
loop,read,%F3%
{
LR=%A_loopReadLine%
if LR=
continue
C1 =
C2 =
C3 =
stringsplit,C,LR,%delim%,
LV_Add("", c1,c2,c3)
}
LV_ModifyCol(1, "Sort CaseLocale") ; or "Sort CaseLocale"
LV_Modify(LV_GetCount(), "Vis") ;scrolls down
Return
Fill4:
gui,2:listview, listview%Tabnumber%
LV_Delete()
loop,read,%F4%
{
LR=%A_loopReadLine%
if LR=
continue
C1 =
C2 =
C3 =
stringsplit,C,LR,%delim%,
LV_Add("", c1,c2,c3)
}
LV_ModifyCol(1, "Sort CaseLocale") ; or "Sort CaseLocale"
LV_Modify(LV_GetCount(), "Vis") ;scrolls down
Return
Fill5:
gui,2:listview, listview%Tabnumber%
LV_Delete()
loop,read,%F5%
{
LR=%A_loopReadLine%
if LR=
continue
C1 =
C2 =
C3 =
stringsplit,C,LR,%delim%,
LV_Add("", c1,c2,c3)
}
LV_ModifyCol(1, "Sort CaseLocale") ; or "Sort CaseLocale"
LV_Modify(LV_GetCount(), "Vis") ;scrolls down
Return
Fill6:
gui,2:listview, listview%Tabnumber%
LV_Delete()
loop,read,%F6%
{
LR=%A_loopReadLine%
if LR=
continue
C1 =
C2 =
C3 =
stringsplit,C,LR,%delim%,
LV_Add("", c1,c2,c3)
}
LV_ModifyCol(1, "Sort CaseLocale") ; or "Sort CaseLocale"
LV_Modify(LV_GetCount(), "Vis") ;scrolls down
Return
Fill7:
gui,2:listview, listview%Tabnumber%
LV_Delete()
loop,read,%F7%
{
LR=%A_loopReadLine%
if LR=
continue
C1 =
C2 =
C3 =
stringsplit,C,LR,%delim%,
LV_Add("", c1,c2,c3)
}
LV_ModifyCol(1, "Sort CaseLocale") ; or "Sort CaseLocale"
LV_Modify(LV_GetCount(), "Vis") ;scrolls down
Return
Fill8:
gui,2:listview, listview%Tabnumber%
LV_Delete()
loop,read,%F8%
{
LR=%A_loopReadLine%
if LR=
continue
C1 =
C2 =
C3 =
stringsplit,C,LR,%delim%,
LV_Add("", c1,c2,c3)
}
LV_ModifyCol(1, "Sort CaseLocale") ; or "Sort CaseLocale"
LV_Modify(LV_GetCount(), "Vis") ;scrolls down
Return
;---------------------------------------------------
;------------------- Modify Text -------------------------
Modify2:
Fx=%A_WorkingDir%\Hotkeys%tabnumber%.txt
ifexist,%fx%
filedelete,%fx%
ControlGet,AA,List,,SysListView32%tabnumber%,%MainWindowTitle% ;<< the correct name of listview
if aa<>
{
stringreplace,AA,AA,%t%,%delim%,all ;<< replaces TAB with Delimiter
stringreplace,AA,AA,`n,`r`n,all
;msgbox, 262208, ,%aa%
AA = %AA%`n
fileappend,%AA%,%fx%
aa=
Return
}
Return
;------------------------------------------------------------------
;------------------- PRINT-Listview -------------------------
PrintLv1:
FileTest=%A_WorkingDir%\PrintListview55.txt
ifexist,%filetest%
filedelete,%filetest%
ControlGet,AA,List,,SysListView32%tabnumber%,%MainWindowTitle% ;<< the correct name of listview
if aa<>
{
stringreplace,AA,AA,%t%,%delim%,all ;<< replaces TAB with Delimiter
stringreplace,AA,AA,`n,`r`n,all
;msgbox, 262208, ,%aa%
fileappend,%AA%,%filetest%
aa=
run,%filetest%
Return
}
Return
;------------------------------------------------------------------
;--- create a testfile ---------------
test1:
;delim = `,
F1=%A_WorkingDir%\Hotkeys1.txt
ifnotexist,%f1%
{
e1=
(Ltrim Join`r`n
Control Alt%delim%^!%delim%patas dio koumpia
Left mouse click%delim%Lclick%delim%patas mouse klik
)
Fileappend,%e1%`r`n,%f1%
}
F2=%A_WorkingDir%\Hotkeys2.txt
ifnotexist,%f2%
{
e2=
(Ltrim Join`r`n
Control Alt%delim%^!%delim%patas dio koumpia
Left mouse click%delim%Lclick%delim%patas mouse klik
)
Fileappend,%e2%`r`n,%f2%
}
F3=%A_WorkingDir%\Hotkeys3.txt
ifnotexist,%f3%
{
e3=
(Ltrim Join`r`n
Control Alt%delim%^!%delim%patas dio koumpia
Left mouse click%delim%Lclick%delim%patas mouse klik
)
Fileappend,%e3%`r`n,%f3%
}
e1=
e2=
e3=
Return
;--- end create a testfile -----------
;============================================================;
;FUNCTIONS
;============================================================;
;show tooltip over GUI elements
WM_MOUSEMOVE(){
static CurrControl, PrevControl, _TT
CurrControl := A_GuiControl
If (CurrControl <> PrevControl){
SetTimer, DisplayToolTip, -100 ; shorter wait, shows the tooltip quicker
PrevControl := CurrControl
}
Return
DisplayToolTip:
try
ToolTip % %CurrControl%_TT
catch
ToolTip
SetTimer, RemoveToolTip, -3000
Return
RemoveToolTip:
ToolTip
Return
}