Ahmed97 Posted April 15, 2011 Share Posted April 15, 2011 (edited) Hi guys , i need ur help pls First, sorry for bad english second, i have problem with this script see this script #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Blaa = GUICreate("Blah bla bla", 434, 98, 329, 300) $browse = GUICtrlCreateButton("Browse", 352, 8, 75, 25, $WS_GROUP) $start = GUICtrlCreateButton("start", 352, 64, 75, 25, $WS_GROUP) $input = GUICtrlCreateInput("", 80, 11, 257, 21) $txt = GUICtrlCreateLabel("choose folder", 8, 13, 68, 17) $DelALL = GUICtrlCreateCheckbox("delete all files", 80, 48, 97, 17) $DELexe = GUICtrlCreateCheckbox("delete exe files", 240, 48, 97, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $browse $Select = FileSelectFolder("Choose Folder Please", "") GUICtrlSetData($input, $Select) Case $nMsg = $start If GUICtrlRead($DelALL) = $GUI_CHECKED Then DirRemove($input,1 ) If GUICtrlRead($DELexe) = $GUI_CHECKED Then FileDelete($input & "\*.exe") EndIf EndIf EndSelect WEnd all things are clear in script want when i press on "Delete all files" the script Delete all files in the folder not the folder with files ,, when i press on "Delete exe files" the script Delete all exe files in the folder and at the end script make ini file to read last buttons and dir i choosed so next time i open the script i see last changes i choosed and script press auto start. Srry again for bad english ^^ please help guys, Thnx Edited April 15, 2011 by TheMaster Link to comment Share on other sites More sharing options...
bogQ Posted April 15, 2011 Share Posted April 15, 2011 (edited) _FileListToArray #Include <File.au3> #Include <Array.au3> $FileList =_FileListToArray(@DesktopDir) If @Error Then MsgBox (0,"","Error.") Exit EndIf ;exe files For $x = 1 To $FileList[0] If StringRight($FileList[$x],4) = ".exe" Then MsgBox (0,"1",$FileList[$x]) Next ;all files and folders For $x = 1 To $FileList[0] MsgBox (0,"2",$FileList[$x]) Next You can use _FileListToArray second and third parametar to get diffrent results, or you can filter the results yourself in loop like i did, In the help file look for IniRead() IniWrite() Edited April 15, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
smartee Posted April 15, 2011 Share Posted April 15, 2011 expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $ini = @ScriptDir & "\history.ini" $Blaa = GUICreate(@ScriptName, 434, 98, 329, 300) $browse = GUICtrlCreateButton("Browse", 352, 8, 75, 25, $WS_GROUP) $start = GUICtrlCreateButton("start", 352, 64, 75, 25, $WS_GROUP) $input = GUICtrlCreateInput("", 80, 11, 257, 21) $txt = GUICtrlCreateLabel("choose folder", 8, 13, 68, 17) $DelALL = GUICtrlCreateCheckbox("delete all files", 80, 48, 97, 17) $DELexe = GUICtrlCreateCheckbox("delete exe files", 240, 48, 97, 17) GUICtrlSetData($input, IniRead($ini, "paths", "lastPath", "")) GUICtrlSetState($DelALL, IniRead($ini, "settings", "dir", $GUI_UNCHECKED)) GUICtrlSetState($DELexe, IniRead($ini, "settings", "exeOnly", $GUI_UNCHECKED)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $browse $Select = FileSelectFolder("Choose Folder Please", "") GUICtrlSetData($input, $Select) IniWrite($ini, "paths", "lastPath", $Select) Case $nMsg = $start $directory = GUICtrlRead($input) If GUICtrlRead($DelALL) = $GUI_CHECKED Then DirRemove($directory, 1) IniWrite($ini, "settings", "dir", $GUI_CHECKED) ElseIf GUICtrlRead($DELexe) = $GUI_CHECKED Then FileDelete($directory & "\*.exe") IniWrite($ini, "settings", "exeOnly", $GUI_CHECKED) EndIf MsgBox(64, @ScriptName, "Done") EndSelect WEnd Link to comment Share on other sites More sharing options...
Ahmed97 Posted April 15, 2011 Author Share Posted April 15, 2011 _FileListToArray #Include <File.au3> #Include <Array.au3> $FileList =_FileListToArray(@DesktopDir) If @Error Then MsgBox (0,"","Error.") Exit EndIf ;exe files For $x = 1 To $FileList[0] If StringRight($FileList[$x],4) = ".exe" Then MsgBox (0,"1",$FileList[$x]) Next ;all files and folders For $x = 1 To $FileList[0] MsgBox (0,"2",$FileList[$x]) Next You can use _FileListToArray second and third parametar to get diffrent results, or you can filter the results yourself in loop like i did, In the help file look for IniRead() IniWrite() hey bogQ, this script not work with me and i dont understand it, im new in autoit and im noob i have looked for ini read/write but it dont work for me, when i open the program it keep reading the ini file and cant select any another dir...may another script file ^^ ? Link to comment Share on other sites More sharing options...
Ahmed97 Posted April 15, 2011 Author Share Posted April 15, 2011 expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $ini = @ScriptDir & "\history.ini" $Blaa = GUICreate(@ScriptName, 434, 98, 329, 300) $browse = GUICtrlCreateButton("Browse", 352, 8, 75, 25, $WS_GROUP) $start = GUICtrlCreateButton("start", 352, 64, 75, 25, $WS_GROUP) $input = GUICtrlCreateInput("", 80, 11, 257, 21) $txt = GUICtrlCreateLabel("choose folder", 8, 13, 68, 17) $DelALL = GUICtrlCreateCheckbox("delete all files", 80, 48, 97, 17) $DELexe = GUICtrlCreateCheckbox("delete exe files", 240, 48, 97, 17) GUICtrlSetData($input, IniRead($ini, "paths", "lastPath", "")) GUICtrlSetState($DelALL, IniRead($ini, "settings", "dir", $GUI_UNCHECKED)) GUICtrlSetState($DELexe, IniRead($ini, "settings", "exeOnly", $GUI_UNCHECKED)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $browse $Select = FileSelectFolder("Choose Folder Please", "") GUICtrlSetData($input, $Select) IniWrite($ini, "paths", "lastPath", $Select) Case $nMsg = $start $directory = GUICtrlRead($input) If GUICtrlRead($DelALL) = $GUI_CHECKED Then DirRemove($directory, 1) IniWrite($ini, "settings", "dir", $GUI_CHECKED) ElseIf GUICtrlRead($DELexe) = $GUI_CHECKED Then FileDelete($directory & "\*.exe") IniWrite($ini, "settings", "exeOnly", $GUI_CHECKED) EndIf MsgBox(64, @ScriptName, "Done") EndSelect WEnd yeaah, This script working 100% thnxx man Thnxx all Link to comment Share on other sites More sharing options...
Ahmed97 Posted April 21, 2011 Author Share Posted April 21, 2011 now i need another help to make Hotkeys in program... see the script : expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $ini = @ScriptDir & "\history.ini" $Blaa = GUICreate(@ScriptName, 434, 98, 329, 300) $browse = GUICtrlCreateButton("Browse", 352, 8, 75, 25, $WS_GROUP) $start = GUICtrlCreateButton("start", 352, 64, 75, 25, $WS_GROUP) $input = GUICtrlCreateInput("", 80, 11, 257, 21) $txt = GUICtrlCreateLabel("choose folder", 8, 13, 68, 17) $DelALL = GUICtrlCreateCheckbox("delete all files", 80, 48, 97, 17) $DELexe = GUICtrlCreateCheckbox("delete exe files", 240, 48, 97, 17) GUICtrlSetData($input, IniRead($ini, "paths", "lastPath", "")) GUICtrlSetState($DelALL, IniRead($ini, "settings", "dir", $GUI_UNCHECKED)) GUICtrlSetState($DELexe, IniRead($ini, "settings", "exeOnly", $GUI_UNCHECKED)) GUISetState(@SW_SHOW) HotKeySet(("{CtrlH}"), GUISetState(@SW_HIDE)) ; Here fail :( HotKeySet(("{CtrlS}"), GUISetState(@SW_SHOW)) ; Here fail :( While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE Exit Case $nMsg = $browse $Select = FileSelectFolder("Choose Folder Please", "") GUICtrlSetData($input, $Select) IniWrite($ini, "paths", "lastPath", $Select) Case $nMsg = $start Or (GUICtrlRead($input) <> "") $directory = GUICtrlRead($input) If GUICtrlRead($DelALL) = $GUI_CHECKED Then DirRemove($directory, 1) IniWrite($ini, "settings", "dir", $GUI_CHECKED) ElseIf GUICtrlRead($DELexe) = $GUI_CHECKED Then FileDelete($directory & "\*.exe") IniWrite($ini, "settings", "exeOnly", $GUI_CHECKED) EndIf EndSelect WEnd ; there failed i need to press any key i choose to hide program, and another key to show it again Link to comment Share on other sites More sharing options...
bogQ Posted April 21, 2011 Share Posted April 21, 2011 HotKeySet("^h", "CtrlH") ; HotKeySet("^s", "CtrlS") ; Func CtrlH() GUISetState(@SW_HIDE,$Blaa) EndFunc Func CtrlS() GUISetState(@SW_HIDE,$Blaa) EndFunc Note that when using the DirRemove($directory, 1) it will remove all subdirectories TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
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