Jump to content

Convert Batch Script To Auto-it Gui


Recommended Posts

I don't understand exactly this batch file, but here is something to beginning :)

#include <GUIConstants.au3>
#Include <File.au3>

$Form1 = GUICreate("AForm1", 622, 441, 192, 125)
$Edit1 = GUICtrlCreateEdit("", 50, 42, 485, 333, -1, $WS_EX_CLIENTEDGE)
$btn1 = GUICtrlCreateButton("Action",250,400,100)
GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $btn1
            Action("C:\hummingbird\cache\")
    EndSelect
WEnd

Func Action($dir_name)
    $FileList=_FileListToArray($dir_name,"*.*",1)
    If @Error Then Return
    
    For $i = 1 to UBound($FileList) - 1
        $file_name = $FileList[$i]
        GUICtrlSetData ($Edit1, $file_name & @CRLF,1)
        FileDelete($dir_name & $file_name)
    Next

    DirRemove($dir_name,1)
    GUICtrlSetData ($Edit1, @CRLF & $dir_name & " deleted.",1)
EndFunc

Be carefull when using FileDelete(), DirRemove() ...

Edited by Zedna
Link to comment
Share on other sites

  • 11 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...