I'm working on a script that shows the folders in a specified directory. When you double click a a folder in a ListView, some action happens.
Also to filter the displayed list, there is a Search box.
I have two versions of the script v.04, has the action on double click working, but the search is broken.
v0.5 has the search working, but the double click action is broken.
Code:
;searchDIR_v0.4
#SingleInstance force
#NoEnv
SetBatchLines, -1
searchDIR=C:\
Gui, Add, Text,,Search:
Gui, Add, Edit, w160 vA_SearchTerm gSearch
Gui, Add, ListView, Checked grid r20 w450 gMyListView Hidden, FileName ;this is the search view
Gui, Add, ListView, Checked grid BackgroundFFDD99 r20 w450 gMyListView xp yp, FileName ;this is the list view
Loop, %searchDIR%\*.*,2
LV_Add("",A_LoopFileName)
LV_ModifyCol()
Gui, Show
return
MyListView:
if A_GuiEvent = DoubleClick
{
LV_GetText(RowText, A_EventInfo)
msgbox, %RowText%
}
return
Search:
Gui, Submit, NoHide
If (A_SearchTerm != "")
{
Gui, ListView, LV1
LV_Delete()
Gui, ListView, LV2
Loop,% LV_GetCount()
{
LV_GetText(RetrievedText, A_Index)
If InStr(RetrievedText, A_SearchTerm)
{
Gui, ListView, LV1
LV_Add("",RetrievedText)
Gui, ListView, LV2
}
}
GuiControl, Hide, LV2
GuiControl, Show, LV1
}
Else
{
GuiControl, Hide, LV1
GuiControl, Show, LV2
}
return
GuiClose:
ExitApp
It is something to do with my naming in lines 10,19; gMyListView, vLV1, vLV2, MyListView. Could someone show me what is wrong please?
Code:
;searchDIR_v0.5
#SingleInstance force
#NoEnv
SetBatchLines, -1
searchDIR=C:\
Gui, Add, Text,,Search:
Gui, Add, Edit, BackgroundFFDD99 w160 vA_SearchTerm gSearch
Gui, Add, ListView, Checked grid r20 w450 vLV1 Hidden, FileName ;this is the search view
Gui, Add, ListView, Checked grid BackgroundFFDD99 r20 w450 vLV2 xp yp, FileName ;this is the list view
Loop, %searchDIR%\*.*,2
LV_Add("",A_LoopFileName)
LV_ModifyCol()
Gui, Show
return
MyListView:
if A_GuiEvent = DoubleClick
{
LV_GetText(RowText, A_EventInfo)
msgbox, %RowText%
}
return
Search:
Gui, Submit, NoHide
If (A_SearchTerm != "")
{
Gui, ListView, LV1
LV_Delete()
Gui, ListView, LV2
Loop,% LV_GetCount()
{
LV_GetText(RetrievedText, A_Index)
If InStr(RetrievedText, A_SearchTerm)
{
Gui, ListView, LV1
LV_Add("",RetrievedText)
Gui, ListView, LV2
}
}
GuiControl, Hide, LV2
GuiControl, Show, LV1
}
Else
{
GuiControl, Hide, LV1
GuiControl, Show, LV2
}
return
GuiClose:
ExitApp