show ' MP3 / wav / wma ' at A_Desktop or A_Mydocuments and can search by FileName
Code: Select all
;https://autohotkey.com/boards/viewtopic.php?f=5&t=44619
;modified = 20180223/2
;created = 20180223
ext1:="mp3,wma,wav,m4a" ;- search files with these extensions in %a_mydocuments% and %a_desktop%
#warn
#NoEnv
SetWorkingDir, %A_ScriptDir%
SendMode,Input
SetBatchLines, -1
Filename1=LV_MusicRead
Gui,2:default
Gui,2:Font,s12, Lucida Console
Gui,2:Color,Black
Gui,2:Color,ControlColor, Black
Gui,2: Add, ListView,grid backgroundGray cBlack x10 y10 h800 w740 gMyLV1 vLV1 +altsubmit, Name|Fullpath
LV_ModifyCol(1, 700),LV_ModifyCol(2,0)
Gui,2:add,Text ,x10 y835 w100 cWhite ,Search-Word=
Gui,2:Font,cDefault,FixedSys
Gui,2:add,Edit ,x140 y830 h27 w130 vSearchx gSearchx cGray,
Gui,2:add,button,x280 y830 h27 w100 vFolder1 gFolder1,Desktop
Gui,2:add,button,x390 y830 h27 w100 vFolder2 gFolder2,MyDoc
Gui,2:add,button,x500 y830 h27 w120 vFolderX gFolderX,FolderSelect
Gui,2:add,Edit ,x640 y830 h27 w100 vTotal cYellow right
Gui,2:show,x10 y10 h870 w780,%filename1%
gosub,folder1
Guicontrol,2:Focus,searchx
return
;-------------------------------------------------
2Guiclose:
exitapp
;--------------------------
FolderX:
PRESELECT = ::{20d04fe0-3aea-1069-a2d8-08002b30309d} ;- search from here
FileSelectFolder,MF,%PRESELECT%
if MF=
return
if (MF="C:\")
xx1:="C:"
goto,fillx
return
folder1:
xx1=%a_desktop%
goto,fillx
return
folder2:
xx1=%a_mydocuments%
goto,fillx
return
;-------------------------------------------------
fillx:
i=0
Gui,2:ListView, LV1
SplitPath,xx1, name2, dir2, ext2, name_no_ext2, drive2
if (xx1="C:")
name2=C_Drive
LV_Delete()
;GuiControl,2: -Redraw,LV1
loop,%xx1%\*.*,0,1
{
x:= a_loopfilefullpath
SplitPath,x, name, dir, ext, name_no_ext, drive
if ext=
continue
else
{
if ext in %ext1%
{
i++
n:= a_loopfilename
LV_Add("",n,x)
GuiControl,2:,Total,%i%
}
}
}
;GuiControl,2: +Redraw,LV1
GuiControl,2:,Total,END=%i%
Guicontrol,2:Focus,searchx
;- maybe save once as textfile for faster reading instead search whole drive
ControlGet,Text2, List, , SysListView321,%filename1%
ifexist,%name2%.txt
filedelete,%name2%.txt
Fileappend,%text2%,%name2%.txt
return
;-------------------------------------------------
MyLV1:
Gui,2:ListView, LV1
if A_GuiEvent = Normal
{
LV_GetText(C2,A_EventInfo,2)
run,%c2%
}
if A_GuiEvent = Rightclick
{
LV_GetText(C2,A_EventInfo,2)
msgbox, 262208,FullPath ,%c2%
}
return
;-------------------------------------------------
searchx:
Gui,2:submit,nohide
Gui,2:ListView, LV1
if searchx=
{
gosub,filltext
return
}
ControlGet,Text1, List, , SysListView321,%filename1% ;- read Listview text
LV_Delete()
GuiControl,2:,Total,
i=0
loop,parse,text1,`n
{
stringsplit,c,a_loopfield,`t ;- split by TAB
if c1 contains %searchx%
{
i++
LV_Add("",c1,c2)
GuiControl,2:,Total,%i%
}
}
return
;---------------------------------------------------
filltext:
LV_Delete()
i=0
Loop,parse,text2,`n,`r
{
stringsplit,c,a_loopfield,`t ;- split by TAB
{
i++
LV_Add("",c1,c2)
}
}
GuiControl,2:,Total,%i%
return
;============ END SCRIPT =====================================