Jump to content

Bllee

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Bllee

  1. every time i press "delete button" delete a line, but i can't add new line with info. the id line write normally but i can't change or add new info obs: looking at the "includes" one realizes that already tried of everything that knew my code #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> #include <StringConstants.au3> #include <Array.au3> #include <GuiListBox.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 612, 480, 192, 154) $MenuItem1 = GUICtrlCreateMenu("&Arquivo") $MenuItem2 = GUICtrlCreateMenuItem("Salvar Ctrl+S", $MenuItem1, $SS_CENTER) $MenuItem4 = GUICtrlCreateMenuItem("Carregar Ctrl+O", $MenuItem1, $SS_CENTER) $MenuItem3 = GUICtrlCreateMenuItem("Salvar Como Shitft+Ctrl+S", $MenuItem1, $SS_CENTER) $Group1 = GUICtrlCreateGroup("", 21, 8, 569, 97, $SS_CENTER) $Input1 = GUICtrlCreateInput("ID COR", 122, 32, 97, 21, $SS_CENTER) $Input2 = GUICtrlCreateInput("REGIÃO", 138, 64, 249, 21, $SS_CENTER) $Input3 = GUICtrlCreateInput("Label", 264, 30, 121, 21, $SS_CENTER) $Label1 = GUICtrlCreateLabel("Label", 232, 32, 30, 17, $SS_CENTER) $Button1 = GUICtrlCreateButton("Capturar Cor", 42, 30, 75, 25, $SS_CENTER) $Button2 = GUICtrlCreateButton("Capturar Região", 42, 62, 91, 25, $SS_CENTER) $Button3 = GUICtrlCreateButton("ADD", 442, 24, 113, 33) $Button5 = GUICtrlCreateButton("Delet", 442, 64, 113, 33) $Group2 = GUICtrlCreateGroup("Editar ID selecionado", 8, 384, 601, 57, $SS_CENTER) $Input7 = GUICtrlCreateInput("ID", 10, 402, 40,21, $SS_CENTER) $Input4 = GUICtrlCreateInput("COR", 51, 402, 121, 21, $SS_CENTER) $Input5 = GUICtrlCreateInput("REGIÃO", 173, 402, 249, 21, $SS_CENTER) $Input6 = GUICtrlCreateInput("LABEL", 423, 402, 121, 21, $SS_CENTER) $Button4 = GUICtrlCreateButton("\/", 544, 400, 30, 25, $SS_CENTER) $Button6 = GUICtrlCreateButton("/\", 574, 400, 30, 25, $SS_CENTER) ; Add column Global $id = Int(0) $List1 = GUICtrlCreateListView("",5, 120, 601, 253, $SS_CENTER) _GUICtrlListView_AddColumn($List1, "ID",40) _GUICtrlListView_AddColumn($List1, "COR",100) _GUICtrlListView_AddColumn($List1, "COORDENADA",305) _GUICtrlListView_AddColumn($List1, "LABEL",150) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem2 MsgBox($MB_SYSTEMMODAL, "ctrl + s", "Nothing Here",1) Case $MenuItem3 MsgBox($MB_SYSTEMMODAL, "shift+ctrl s", "Nothing Here",1) Case $MenuItem4 MsgBox($MB_SYSTEMMODAL, "ctrl + o", "Nothing Here",1) Case $Button1 MsgBox($MB_SYSTEMMODAL, "Capturar cor", "Aperte espaço para capturar a cor") GUICtrlSetData($Input1,MouseColor()) Case $Button2 MsgBox($MB_SYSTEMMODAL, "capturar região", "Aperte espaço para capturar a posição inicial") local $mouse = MouseGetPos() $x_init = $mouse[0] $y_init = $mouse[1] MsgBox($MB_SYSTEMMODAL, "capturar região", "Aperte espaço para capturar a posição final") local $mouse = MouseGetPos() $x_end = $mouse[0] $y_end = $mouse[1] GUICtrlSetData($Input2,$x_init&','&$y_init&' ; '&$x_end&','&$y_end) Case $Button3 _GUICtrlListView_AddItem($List1, $id, 1) ; id _GUICtrlListView_AddSubItem($List1, $id, GUICtrlRead($Input1), 1, 1) ;cor _GUICtrlListView_AddSubItem($List1, $id, GUICtrlRead($Input2), 2, 1) ;coordenada _GUICtrlListView_AddSubItem($List1, $id, GUICtrlRead($Input3), 3, 1) ;label $id= $id + 1 Case $Button4 $Item = _GUICtrlListView_GetSelectedIndices($List1) $Sid = _GUICtrlListView_GetItem($List1, Number($Item),0) $Scor = _GUICtrlListView_GetItem($List1, Number($Item),1) $Scord = _GUICtrlListView_GetItem($List1, Number($Item),2) $Slabel = _GUICtrlListView_GetItem($List1, Number($Item),3) ; get info GUICtrlSetData($Input7,$Sid[3]) GUICtrlSetData($Input4,$Scor[3]) GUICtrlSetData($Input5,$Scord[3]) GUICtrlSetData($Input6,$Slabel[3]) Case $Button5 _GUICtrlListView_DeleteItemsSelected($List1) Case $Button6 ; give back inf if GUICtrlRead($Input7) <> "ID" Then _GUICtrlListView_SetItem($List1, GUICtrlRead($Input4), GUICtrlRead($Input7),1) ;cor _GUICtrlListView_SetItem($List1, GUICtrlRead($Input5), GUICtrlRead($Input7),2) ;coordenada _GUICtrlListView_SetItem($List1, GUICtrlRead($Input6), GUICtrlRead($Input7),3) ;coordenada EndIf EndSwitch WEnd Func MouseColor() local $mouse = MouseGetPos() Return Hex(PixelGetColor($mouse[0],$mouse[1]), 6) EndFunc
  2. I'm here today to do my part. for months I'm consuming content, but today I come to provide a script that I did. this script looks for files from fragments of their names. being able to look for extensions or archimes with the same name. searching directories and subdirectories. I did this script only to browse the file and delete, because it is my nescessity in the moment . it has the option of only deleting without warning, or advising which file should be deleted or not. has tray options. I made it in a portuguese brazil, and I will not translate. Test and then tell me what you think. GUI deletar.au3 < this is the main file, it contains the main functions and GUI functions #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <TrayConstants.au3> #RequireAdmin Global $Caminho Global $idCheckbox Global $Warning $Path = IniRead(@ScriptDir & "/config.ini", "Cfg", "Caminho","") $word = IniRead(@ScriptDir & "/config.ini", "Cfg", "Palavra","") $iMsgBoxAnswer = IniRead(@ScriptDir & "/config.ini", "Cfg", "Checkbox","") ;~ $CheckDuplo = "Find N Delet" ;~ If WinExists($CheckDuplo) Then ;~ MsgBox(0,"","Already Running",1) ;~ Exit ; It's already running ;~ EndIf #Region ### START Koda GUI section ### Form= $width = 290 $height = 100 $Form1 = GUICreate("Find N Delet", 290, 106, @DesktopWidth/2 - $width/2, @DesktopHeight/2 - $height/2, $GUI_SS_DEFAULT_GUI, BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE)) GUISetIcon(@ScriptDir & '\icone.ico', -1) TraySetIcon (@ScriptDir & '\icone.ico', -1) $Label1 = GUICtrlCreateLabel("Palavra", 8, 16, 40, 17, $SS_CENTER) $Label2 = GUICtrlCreateLabel("Caminho", 8, 40, 45, 17, $SS_CENTER) $Checkbox = GUICtrlCreateCheckbox("Avisar deleção", 184, 16, 97, 17) if $iMsgBoxAnswer == 1 Then GUICtrlSetState(-1, $GUI_CHECKED) EndIf $idCheckbox = GUICtrlRead($CheckBox) $Button1 = GUICtrlCreateButton("Capturar", 16, 72, 259, 25) $Input1 = GUICtrlCreateInput("", 56, 16, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) GUICtrlSetData(-1,$word) $Input2 = GUICtrlCreateInput("", 56, 40, 121, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_LEFT)) GUICtrlSetData(-1,$Path) $Button2 = GUICtrlCreateButton("Caminho", 184, 40, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### if FileExists(@ScriptDir & "\config.ini") Then FileSetAttrib(@ScriptDir & "\config.ini", "+H") Else IniWrite(@ScriptDir & "/config.ini", "Cfg", "Caminho",'') IniWrite(@ScriptDir & "/config.ini", "Cfg", "Palavra",'') IniWrite(@ScriptDir & "/config.ini", "Cfg", "Checkbox",'') FileSetAttrib(@ScriptDir & "\config.ini", "+H") EndIf TrayCreateItem("Captura Rápida") TrayItemSetOnEvent(-1,"duplound") TrayCreateItem("") TrayCreateItem("Captura") TrayItemSetOnEvent(-1,"rastrei") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"_exit") TraySetState($TRAY_ICONSTATE_SHOW) Opt("TrayAutoPause", 0) Opt("TrayMenuMode", 3) Opt("TrayIconHide", 0) opt("TrayOnEventMode", 1) While 1 If ProcessExists ("Finder.exe") Then TraySetState(4) Else TraySetState(1) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $CheckBox If GUICtrlRead($CheckBox) = $GUI_CHECKED Then Global $idCheckbox = 1 Global $Path = $idCheckbox Else Global $idCheckbox = 3 Global $Path = $idCheckbox EndIf Case $Button1 RegEscrever() FazerMagiaAcontecer() Case $Button2 Global $Caminho = selectfolder() GUICtrlSetData($Input2, $Caminho) ;~ MsgBox(0,"",$Caminho ) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd #Region ### Funcoes ### Func duplound() if $Caminho == '' Then $Caminho = $Path IniWrite(@ScriptDir & "/config.ini", "Cfg", "Caminho",$Caminho) IniWrite(@ScriptDir & "/config.ini", "Cfg", "Palavra",GUICtrlRead($Input1)) IniWrite(@ScriptDir & "/config.ini", "Cfg", "Checkbox",4) FazerMagiaAcontecer() EndFunc Func rastrei() if $Caminho == '' Then $Caminho = $Path IniWrite(@ScriptDir & "/config.ini", "Cfg", "Caminho",$Caminho) IniWrite(@ScriptDir & "/config.ini", "Cfg", "Palavra",GUICtrlRead($Input1)) IniWrite(@ScriptDir & "/config.ini", "Cfg", "Checkbox",1) FazerMagiaAcontecer() EndFunc Func RegEscrever() if $Caminho == '' Then $Caminho = $Path IniWrite(@ScriptDir & "/config.ini", "Cfg", "Caminho",$Caminho) IniWrite(@ScriptDir & "/config.ini", "Cfg", "Palavra",GUICtrlRead($Input1)) IniWrite(@ScriptDir & "/config.ini", "Cfg", "Checkbox",$idCheckbox) EndFunc Func _exit() Exit EndFunc Func FazerMagiaAcontecer() Run(@ScriptDir & "\finder.exe") EndFunc Func selectfolder() ; Create a constant variable in Local scope of the message to display in FileSelectFolder. Local Const $sMessage = "Select a folder" ; Display an open dialog to select a file. Local $sFileSelectFolder = FileSelectFolder($sMessage, "") If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "Nenhuma pasta foi selecionada.") Else ; Display the selected folder. ;~ MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder) EndIf Return $sFileSelectFolder EndFunc ;==>Example #EndRegion ### Funcoes ### finder.au3 < this file contains the search function, I recommend compiling it into .exe to work properly $Path = IniRead(@ScriptDir & "/config.ini", "Cfg", "Caminho","") $word = IniRead(@ScriptDir & "/config.ini", "Cfg", "Palavra","") $iMsgBoxAnswer = IniRead(@ScriptDir & "/config.ini", "Cfg", "Checkbox","") While 1 if $Path == '' Then MsgBox(16,"Erro", "Defina um caminho para rastreio") WinActivate("[TITLE:Find N Delet]") EndIf if $word == '' Then MsgBox(16,"Erro", "Defina uma palavra para rastreio") WinActivate("[TITLE:Find N Delet]") EndIf Searchengine($Path,$word, $iMsgBoxAnswer) ;~ MsgBox(0,'',"oi") WEnd Func Searchengine($Path,$word, $iMsgBoxAnswer) $Path = $Path ;<---- The path where all begins... dim $folders[4] $Files = "" $dirs = "" $result = "" $word = $word if $iMsgBoxAnswer == '' then $iMsgBoxAnswer = 2 If StringInStr(FileGetAttrib($path),"d") Then $folders[0] = 1 $folders[1] = $Path While 1 For $c = 1 to $folders[0] If StringRight($folders[$c],1) == "\" Then $Folders[$c] = StringLeft($folders[$c],StringLen($folders[$c])-1) $search = FileFindFirstFile($folders[$c] & "\*.*") If $search <> -1 Then While 1 $result = FileFindNextFile($search) If @error Then ExitLoop If $result <> "." AND $result <> ".." Then $result = $folders[$c] & "\" & $result If StringInStr(FileGetAttrib($result),"d") Then $dirs = $dirs & "|" & $result $files = $files & "|" & $result ; << --- Remove this line if you do not want the folders names in the final list... ;or use an other var if you want divide. Else ;~ proxima linha mudar comando ;~ If StringInStr($result, $word ) Then Msgbox(0,"",$result & " - " &$word &" exists in the string") If StringInStr($result, $word ) And Not StringInStr($result, '$RECYCLE.BIN' ) Then ;~ Msgbox(0,"",$result & " - " &$word &" exists in the string") if $iMsgBoxAnswer == 1 then $iMsgBoxAnswer = Msgbox(33,"Deletar ?","Caminho: " &$result & @CRLF & "Palavra: " &$word) Select Case $iMsgBoxAnswer = 1 ;OK FileRecycle($result) Case $iMsgBoxAnswer = 2 ;Cancel EndSelect if $iMsgBoxAnswer == 3 then FileRecycle($result) if $iMsgBoxAnswer == 4 then FileRecycle($result) EndIf EndIf EndIf WEnd FileClose($search) EndIf Next If $dirs = "" Then ExitLoop $folders = 0 $dirs = StringRight($dirs,StringLen($dirs) - 1) $folders = StringSplit($dirs,"|") $dirs = "" WEnd EndIf ;~ $files = StringRight($files,StringLen($files) - 1) ;~ $files = StringReplace($files,"|",@crlf) ;~ FileWrite("l:\list.txt",$files) Exit EndFunc icone.ico < my .ico ♥ setup finder.exe < with the help of the program innosetup-5.5.9.exe I did an final installer. Enjoy and any doubt comment
×
×
  • Create New...