Code:
;Delete AVA .erl files by Yuknowho
#AutoIt3Wrapper_run_obfuscator=y
#Obfuscator_parameters=/striponly
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#RequireAdmin
#region ### START Koda GUI section ### Form=D:\Program Files\Koda\Forms\AVA erl Delete v1.kxf
$MainForm = GUICreate("AVA .erl Delete | v1.2 | Yuknowho - Mpgh", 347, 58, 192, 124)
;Labels:
$MpghLabel = GUICtrlCreateLabel("MPGH", 240, 28, 78, 28)
GUICtrlSetFont(-1, 18, 400, 2, "Palatino Linotype")
GUICtrlSetColor(-1, 0x000080)
;Inputs:
$PathInput = GUICtrlCreateInput("C:\", 8, 8, 329, 21)
GUICtrlSetData( -1, IniRead( 'Path.ini', 'GameGuard .erl Files', 'Path', 'C:\' ) )
GUICtrlSetState(-1, $GUI_DISABLE)
;Buttons:
$Edit = GUICtrlCreateButton("Edit", 96, 32, 83, 25)
$Start = GUICtrlCreateButton("Start", 8, 32, 83, 25)
$ChoosePath = GUICtrlCreateButton("...", 184, 32, 27, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
HotKeySet( '{F9}', '_ToggleQuit' )
Global $EditToggle = False
Global $StartToggle = False
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Edit
_EditPath()
Case $ChoosePath
_SetPath()
Case $Start
_StartDelete()
EndSwitch
WEnd
Func _EditPath()
If $EditToggle = False Then
GUICtrlSetState( $Start, $GUI_DISABLE )
GUICtrlSetState( $PathInput, $GUI_ENABLE )
GUICtrlSetState( $ChoosePath, $GUI_ENABLE )
GUICtrlSetData( $Edit, 'Save' )
Else
IniWrite( 'Path.ini', 'GameGuard .erl Files', 'Path', GUICtrlRead( $PathInput ) )
GUICtrlSetState( $Start, $GUI_ENABLE )
GUICtrlSetState( $PathInput, $GUI_DISABLE )
GUICtrlSetState( $ChoosePath, $GUI_DISABLE )
GUICtrlSetData( $Edit, 'Edit' )
EndIf
$EditToggle = Not $EditToggle
EndFunc ;==>_EditPath()
;EndFunc
Func _SetPath()
Local $FilePath = ''
$FilePath = FileSelectFolder( 'Select GameGuard folder where .erl files are stored', GUICtrlRead( $PathInput ) )
If $FilePath = Not '' Then
GUICtrlSetData( $PathInput, $FilePath )
EndIf
EndFunc ;==>_SetPath()
;EndFunc
Func _StartDelete()
Local $Path = GUICtrlRead( $PathInput )
Local $Files
GUICtrlSetData( $Start, 'Quit: F9' )
GUICtrlSetState( $Start, $GUI_DISABLE )
GUICtrlSetState( $Edit, $GUI_DISABLE )
$StartToggle = True
While $StartToggle = True
$Files = _FileListToArray( $Path, '*.erl', 1 )
If IsArray( $Files ) Then
For $i = 1 To Ubound( $Files ) - 1
FileDelete( $Path & '\' & $Files[$i] )
Next
EndIf
;Sleep( 10 )
WEnd
GUICtrlSetData( $Start, 'Start' )
GUICtrlSetState( $Start, $GUI_ENABLE )
GUICtrlSetState( $Edit, $GUI_ENABLE )
EndFunc ;==>_StartDelete()
;EndFunc
Func _ToggleQuit()
If $StartToggle = True Then
$StartToggle = False
EndIf
EndFunc ;==>_ToggleQuit()
;EndFunc