Belini Posted October 7, 2012 Posted October 7, 2012 (edited) The purpose of this script is to list all folders and sub-folders in the directory chosen and then renumber always taking the first letter of each folder also allows navigation from one folder at a time, the name and number of each folder is shown at an interface graphic with a dial indicating the letter corresponding to the currently selected folder. Link Download: http://www.mediafire.com/?rt9y6y39re8rb9g Edited October 8, 2012 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
AZJIO Posted October 7, 2012 Posted October 7, 2012 I do not understand it, but optimized a bit.expandcollapse popup; ==================================================================== ; Autoit3 3.3.9.2 ; Autor: Belini ; Data: 07/10/2012 ; Objetivo: Navegar procurando pastas de letra em letra ou uma por uma ; ==================================================================== #Region includes #include <Misc.au3> #include <String.au3> #include <Array.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #EndRegion includes #Region declaraзгo das variбveis Global $Numero_letra = -1, $lista_pastas, $faz_contagem = 0, $contador_cd = 0 Global $conta_letras = -1, $Alfabeto[26], $numera[26], $Label[26] Global $Label_dir, $Label_Num, $Label_Cd, $Label_Letra, $Last_Label #EndRegion declaraзгo das variбveis #Region cria a interface grбfica $Form1_1 = GUICreate("Form1", 1050, 120, -1, -1) For $i = 0 To 25 $Alfabeto[$i] = Chr(65 + $i) $Label[$i] = GUICtrlCreateLabel($Alfabeto[$i], 16 + 40 * $i, 8, 20, 35, BitOR($SS_CENTER, $WS_BORDER)) GUICtrlSetFont(-1, 20, 800, 0, "Courier New") Next ; _ArrayDisplay($Alfabeto, 'Alfabeto') ; _ArrayDisplay($Label, 'Label') ; GUICtrlSetFont(-1, 20, 800, 0, "Courier New") $Label_Num = GUICtrlCreateLabel("NЪMERO:", 8, 56, 100, 20) GUICtrlSetFont(-1, 10, 800, 0, "Courier New") $Label_dir = GUICtrlCreateLabel("DIRETУRIO:", 120, 56, 700, 20) GUICtrlSetFont(-1, 10, 800, 0, "Courier New") $Label_Letra = GUICtrlCreateLabel("1Є LETRA:", 8, 88, 100, 20) GUICtrlSetFont(-1, 10, 800, 0, "Courier New") $Label_Cd = GUICtrlCreateLabel("CD:", 120, 88, 884, 20) GUICtrlSetFont(-1, 10, 800, 0, "Courier New") GUICtrlSetBkColor($Label[0], 0xFF0000) $Last_Label = $Label[0] GUISetState(@SW_SHOW) #EndRegion cria a interface grбfica #Region Procura e lista pastas e subpastas $DllOpen = DllOpen("user32.dll"); abre a dll para monitorar as teclas lista_pastas("MUSICAS", 0); caminho da pasta $lista_pastas = StringTrimRight($lista_pastas, 1); tira "|" do final $lista_pastas = _StringExplode($lista_pastas, "|", 0); separa os arquivos atribuindo um nъmero a ele $conta_cds = UBound($lista_pastas); pega o nъmero de pastas listadas $conta_cds = $conta_cds - 1; nъmero listado menos 1 pois a listagem comeзa em zero _ArraySort($lista_pastas); coloca os arquivos em ordem alfabйtica $conta_pastas = UBound($lista_pastas); pega o nъmero de arquivos que foi listado contagem(); faz a contagem e numera o primeiro cd de cada letra #EndRegion Procura e lista pastas e subpastas ;mensagem_teste(); mostra o nъmero do primeiro cd de cada letra teste_um_emum(); pula de cd para cd 1 a 1 While 1; Loop principal If $GUI_EVENT_CLOSE = GUIGetMsg() Then Exit If _IsPressed('27', $DllOpen) Then Sleep(300) seleciona(1) EndIf If _IsPressed('25', $DllOpen) Then Sleep(300) seleciona(2) EndIf WEnd #Region Funзхes relativas ao alfabeto Func define_letra() Switch $contador_cd Case $numera[0] To $numera[1] - 1 $faz_contagem = 0 Case $numera[1] To $numera[2] - 1 $faz_contagem = 1 Case $numera[2] To $numera[3] - 1 $faz_contagem = 2 Case $numera[3] To $numera[4] - 1 $faz_contagem = 3 Case $numera[4] To $numera[5] - 1 $faz_contagem = 4 Case $numera[5] To $numera[6] - 1 $faz_contagem = 5 Case $numera[6] To $numera[7] - 1 $faz_contagem = 6 Case $numera[7] To $numera[8] - 1 $faz_contagem = 7 Case $numera[8] To $numera[9] - 1 $faz_contagem = 8 Case $numera[9] To $numera[10] - 1 $faz_contagem = 9 Case $numera[10] To $numera[11] - 1 $faz_contagem = 10 Case $numera[11] To $numera[12] - 1 $faz_contagem = 11 Case $numera[12] To $numera[13] - 1 $faz_contagem = 12 Case $numera[13] To $numera[14] - 1 $faz_contagem = 13 Case $numera[14] To $numera[15] - 1 $faz_contagem = 14 Case $numera[15] To $numera[16] - 1 $faz_contagem = 15 Case $numera[16] To $numera[17] - 1 $faz_contagem = 16 Case $numera[17] To $numera[18] - 1 $faz_contagem = 17 Case $numera[18] To $numera[19] - 1 $faz_contagem = 18 Case $numera[19] To $numera[20] - 1 $faz_contagem = 19 Case $numera[20] To $numera[21] - 1 $faz_contagem = 20 Case $numera[21] To $numera[22] - 1 $faz_contagem = 21 Case $numera[22] To $numera[23] - 1 $faz_contagem = 22 Case $numera[23] To $numera[24] - 1 $faz_contagem = 23 Case $numera[24] To $numera[25] - 1 $faz_contagem = 24 Case $numera[25] To $conta_cds $faz_contagem = 25 EndSwitch EndFunc Func seleciona($flag = 0) Local $nome_cd, $diretorio If $flag = 1 Or $flag = 2 Then If $flag = 1 Then $faz_contagem += 1 Else $faz_contagem -= 1 EndIf If $faz_contagem > 25 Then $faz_contagem = 0 If $faz_contagem < 0 Then $faz_contagem = 25 $nome_cd = StringMid($lista_pastas[$faz_contagem], 1, StringInStr($lista_pastas[$faz_contagem], "#", 2, -1) - 1) $diretorio = StringTrimLeft($lista_pastas[$faz_contagem], StringInStr($lista_pastas[$faz_contagem], "#", 2, -1)) GUICtrlSetData($Label_Letra, "1Є LETRA: " & $Alfabeto[$faz_contagem]) GUICtrlSetData($Label_Num, "NЪMERO:" & $numera[$faz_contagem]) GUICtrlSetData($Label_dir, "DIRETУRIO: " & $diretorio) GUICtrlSetData($Label_Cd, "CD: " & $nome_cd) Else define_letra() EndIf If $Label[$faz_contagem] <> $Last_Label Then GUICtrlSetBkColor($Label[$faz_contagem], 0xFF0000) GUICtrlSetBkColor($Last_Label, $GUI_BKCOLOR_TRANSPARENT) $Last_Label = $Label[$faz_contagem] EndIf EndFunc #EndRegion Funзхes relativas ao alfabeto #Region numera a primeira pasta de cada letra Func contagem() $Numero_letra = 0 While 1 $Numero_letra += 1 If $Numero_letra > 25 Then ExitLoop numera() WEnd If $numera[25] = "" Then $numera[25] = 0 EndFunc Func numera() While 1 $conta_letras += 1 If $conta_letras > $conta_cds Then ExitLoop $compara = StringCompare(StringMid($lista_pastas[$conta_letras], 1, 1), $Alfabeto[$Numero_letra], 2) If StringMid($lista_pastas[$conta_letras], 1, 1) > $Alfabeto[$Numero_letra] And $conta_letras <= $conta_cds Then $numera[$Numero_letra] = $conta_letras + 1 ExitLoop EndIf If $compara = 0 Then $numera[$Numero_letra] = $conta_letras ExitLoop EndIf WEnd EndFunc #EndRegion numera a primeira pasta de cada letra #Region Procura pastas e sub-pastas Func lista_pastas($caminho = "", $contador = 0) $contador = 0 $caminho &= "" Local $verifica = '', $arquivo, $procura_pasta = FileFindFirstFile($caminho & '*') If $procura_pasta = -1 Then Return '' While 1; $arquivo = FileFindNextFile($procura_pasta) If @error Then ExitLoop If @extended Then If $contador >= 10 Then ContinueLoop $verifica &= lista_pastas($caminho & $arquivo, $contador + 1) $apenas_pasta = StringMid($caminho & $arquivo, StringInStr($caminho & $arquivo, "", 2, -1) + 1) $lista_pastas &= $apenas_pasta & " #" & $caminho & $arquivo & "|" EndIf WEnd FileClose($procura_pasta) Return $verifica EndFunc #EndRegion Procura pastas e sub-pastas #Region TESTES Func teste_um_emum() Local $nome_cd, $diretorio While 1 $contador_cd += 1 Sleep(50) If $contador_cd > $conta_cds Then $contador_cd = 0 If $contador_cd < 0 Then $contador_cd = $conta_cds $diretorio = StringTrimLeft($lista_pastas[$contador_cd], StringInStr($lista_pastas[$contador_cd], "#", 2, -1)) $nome_cd = StringMid($lista_pastas[$contador_cd], 1, StringInStr($lista_pastas[$contador_cd], "#", 2, -1) - 1) GUICtrlSetData($Label_Letra, "1Є LETRA: " & $Alfabeto[$faz_contagem]) GUICtrlSetData($Label_Num, "NЪMERO:" & $contador_cd) GUICtrlSetData($Label_dir, "DIRETУRIO: " & $diretorio) GUICtrlSetData($Label_Cd, "CD: " & $nome_cd) seleciona() WEnd EndFunc Func mensagem_teste() MsgBox(4096, '', "A = " & $numera[0] & @CRLF & "B = " & $numera[1] & @CRLF & "C = " & $numera[2] & @CRLF & "D = " & $numera[3] & @CRLF & _ "E = " & $numera[4] & @CRLF & "F = " & $numera[5] & @CRLF & "G = " & $numera[6] & @CRLF & "H = " & $numera[7] & @CRLF & _ "I = " & $numera[8] & @CRLF & "J = " & $numera[9] & @CRLF & "K = " & $numera[10] & @CRLF & "L = " & $numera[11] & @CRLF & _ "M = " & $numera[12] & @CRLF & "N = " & $numera[13] & @CRLF & "O = " & $numera[14] & @CRLF & "P = " & $numera[15] & @CRLF & _ "Q = " & $numera[16] & @CRLF & "R = " & $numera[17] & @CRLF & "S = " & $numera[18] & @CRLF & "T = " & $numera[19] & @CRLF & _ "U = " & $numera[20] & @CRLF & "V = " & $numera[21] & @CRLF & "W = " & $numera[22] & @CRLF & "X = " & $numera[23] & @CRLF & _ "Y = " & $numera[24] & @CRLF & "Z = " & $numera[25], 2) EndFunc #EndRegion TESTES My other projects or all
Belini Posted October 8, 2012 Author Posted October 8, 2012 (edited) I do not understand it, but optimized a bit.I'm working on a script for jukeboxes, see: Edited October 16, 2012 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
wakillon Posted October 8, 2012 Posted October 8, 2012 At this step it seems that navigation can't be used AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts
Belini Posted October 8, 2012 Author Posted October 8, 2012 (edited) Line 64 (teste_um_emum ()) is only a test, disable this line and use the left or right arrow to jump in letter letter. Fixed error on lines 155 and 156, added optimization done by AZJIO: http://www.mediafire.com/?rt9y6y39re8rb9g Edited October 8, 2012 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now