Nahuel Posted August 31, 2007 Posted August 31, 2007 (edited) I want to make a script for changing the names of all the files in a directory. Here's what I've done: expandcollapse popup#include <File.au3> #include <Constants.au3> #include <Guiconstants.au3> Opt("GUIOnEventMode",1) $lista1=_FileListToArray(@ScriptDir,"*.*") $altolista=(25 * $lista1[0]) $altoventana=$altolista+20 If $altoventana > @DesktopHeight Then MsgBox(0,"","Demasiados archivos en el directorio!") Exit EndIf GUICreate("",300,$altoventana) GUISetOnEvent($GUI_EVENT_CLOSE,"_exit") GUISetState() GUICtrlCreateButton("Cambiar nombre",125,$altoventana-35) GUICtrlSetOnEvent(-1,"cambiar_nombre") obtenerArchivos() Func _exit() Exit EndFunc Func obtenerArchivos() $iCheckboxPos = 15 Global $aCheckbox[UBound($lista1) ] For $i = 1 To $lista1[0] Step 1 $aCheckbox[$i] = GUICtrlCreateCheckbox($lista1[$i], 10, $iCheckboxPos, -1, 20) GUICtrlSetState(-1, $GUI_CHECKED) $iCheckboxPos = $iCheckboxPos + 20 $aCheckbox[0] = UBound($aCheckbox) Next EndFunc Func cambiar_nombre() For $i = 1 To (UBound($aCheckbox)-1) $sActiveCheckbox = $aCheckbox[$i] If GUICtrlRead($sActiveCheckbox) = $GUI_CHECKED Then MsgBox(0,"",GUICtrlRead($aCheckbox[$i])) GUICtrlSetState($sActiveCheckbox, $GUI_UNCHECKED) EndIf Next EndFunc While 1 Sleep(100) WEnd This won't change the names of any files, because I didn't finish it. My problem is that I can't get it to read the names of the files that are checked! It always returns 1 Edited August 31, 2007 by Nahuel
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