Тема: AHK: Поиск в папке и вставка их в список GUI
В общем надо сделать скрипт, который ищет в папке которую я укажу ищет файлы с определённым расширением и выдавал их список в гуи.
Знаю, что там с loop, но у меня показывал только один файл.
Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.
Страницы 1
Чтобы отправить ответ, вы должны войти или зарегистрироваться
В общем надо сделать скрипт, который ищет в папке которую я укажу ищет файлы с определённым расширением и выдавал их список в гуи.
Знаю, что там с loop, но у меня показывал только один файл.
В общем надо сделать скрипт, который ищет в папке которую я укажу ищет файлы с определённым расширением и выдавал их список в гуи.
Знаю, что там с loop, но у меня показывал только один файл.
SetFormat, FloatFast, 1
ClipBack:=ClipboardAll
Menu, Tray, NoStandard
Menu, Tray, Icon, shell32.dll, 4
Menu, Tray, Tip, File list
Menu, Tray, Add, &Exit (Tilde+Esc), ExitScript
Hotkey, vkC0 & Esc, ExitScript
Gui, Add, Button, gButton vAction x8 y10 w91 h25, Start
Gui, Add, Button, xp y46 wp hp, Copy
Gui, Add, Edit, vExtention x54 y86 w38 h18, % Extention:="*.*"
Gui, Add, Edit, vFileList x109 y10 w353 h280
Gui, Add, Text, x14 y88 w38 h16, Pattern:
Gui, Add, Text, xp y108 w60 hp, Read only
Gui, Add, Text, xp y126 wp hp, System
Gui, Add, Text, xp y146 wp hp, Hidden
Gui, Add, Text, xp y166 wp hp, Compressed
Gui, Add, Text, xp y184 wp hp, Temporary
Gui, Add, Text, xp y208 w38 hp, Folders:
Gui, Add, Text, xp y226 wp hp, Files:
Gui, Add, Text, xp y245 w53 hp, Processed:
Gui, Add, CheckBox, Checked1 vR x78 y108 w16 hp
Gui, Add, CheckBox, Checked1 vS xp y126 wp hp
Gui, Add, CheckBox, Checked1 vH xp y146 wp hp
Gui, Add, CheckBox, Checked1 vC xp y166 wp hp
Gui, Add, CheckBox, Checked1 vT xp y184 wp hp
Gui, Add, Text, vFolderCount x70 y208 w34 hp
Gui, Add, Text, vFileCount xp y228 wp hp
Gui, Add, Text, vProgressCount xp y246 wp hp
Gui, Add, Progress, vProgressBar x8 y264 w91 h25
Gui, Add, GroupBox, x8 y74 w91 h132
Gui, -MaximizeBox
Gui, Show, Center w472 h300, List files
Clear()
Return
Button:
If Start
{
MsgBox, 4144, Info, Stopped!, 1
GuiControl,, Action, Start
Clear()
Return
}
SetTimer, Action, -0
Return
Action:
Clear()
Gui, Submit, NoHide
If !Extention OR Extention="*." OR Extention="*"
Goto, IfExt
Else If Extention Not Contains *.
Goto, IfExt
FileSelectFolder, SelectFolder,, 2, Select folder to view content
If ErrorLevel
{
Gui, 2:Add, Text, x12 y30 w90 h90, Choose folder!
Gui, 2:Add, Button, gClear x42 y70 w80 h30, OK
Gui, 2:+AlwaysOnTop -SysMenu
Gui, 2:Show, Center, Error
Return
}
SetWorkingDir, % SelectFolder
GuiControl,, Action, Stop
Start:=True, FAttR:=!R ? "R,":""
FAttS:=!S ? "S,":"", FAttH:=!H ? "H,":""
FAttC:=!C ? "C,":"", FAttT:=!T ? "T,":""
Loop, % Extention, 1, 1
{
Counter++
If !Start
{
Goto, IfStopped
Break
}
}
Loop, % Extention, 1, 1
{
If A_LoopFileAttrib Contains % FAttR FAttS FAttH FAttC FAttT
Continue
Else If A_LoopFileAttrib Contains D
{
FolCounter++
GuiControl,, FolderCount, % FolCounter
}
Else
{
FilCounter++
GuiControl,, FileCount, % FilCounter
}
GuiControl,, ProgressBar, % A_Index/Counter*100
GuiControl,, ProgressCount, % A_Index/Counter*100 " %"
FileList.=A_LoopFileLongPath "`n"
If % Counter=A_Index
StringTrimRight, FileList, FileList, 1
GuiControl,, FileList, % FileList
If !Start
{
Goto, IfStopped
Break
}
}
Start:=False
GuiControl,, Action, Start
MsgBox, 4160, Info, Done!, 1
IfStopped:
Return
IfExt:
Gui, 2:Add, Text, Center x12 y30 w90 h90, Incorrect mask!
Gui, 2:Add, Button, gClear x42 y70 w80 h30, OK
Gui, 2:+AlwaysOnTop -SysMenu
Gui, 2:Show, Center, Error
GuiControl,, Extention, *.*
Return
ButtonCopy:
If Start Or !FileList
{
If Start
MsgBox, 4112, Error, Wait until the end operation!, 1
Else
{
Gui, 2:Add, Text, Center x12 y30 w90 h90, Empty list!
Gui, 2:Add, Button, gClear x42 y70 w80 h30, OK
Gui, 2:+AlwaysOnTop -SysMenu
Gui, 2:Show, Center, Error
}
Return
}
MsgBox, 4160, Info, Saved!, 1
Clear(1)
Return
Clear:
Gui, 2:Destroy
Clear()
Return
GuiClose:
ExitScript:
Clipboard:=ClipBack
ExitApp
Clear(Copy=0)
{
global
Clipboard:=Copy ? FileList:""
Start:=Counter:=False
GuiControl,, FileList, % FileList:=""
GuiControl,, FolderCount, % FolCounter:=0
GuiControl,, FileCount, % FilCounter:=0
GuiControl,, ProgressBar, 0
GuiControl,, ProgressCount, % 0 " %"
}
Страницы 1
Чтобы отправить ответ, вы должны войти или зарегистрироваться