MattHiggs

Auto UDF extraction/copy

1 post in this topic

#1 ·  Posted (edited)

Hey AutoIT scripters.

I recently (like this afternoon) wrote a script which would allow for quicker utilization of community-developed UDFs by allowing a user to select multiple files and, if uncompressed (will be either a dll or au3), will automatically move the files to the "Includes" folder in the autoIT installation directory.  If the file is compressed, it will extract the content, and then perform the same operation on the extracted files (only difference is that all of the files that were in archive get copied, not just au3 or dll).  Note that if you modified the installation directory, use the 64-bit version of autoit, or compile the script into a 64-bit exe, you will need to modify the paths to the autoit Includes folder to be valid:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
; *** Start added by AutoIt3Wrapper ***
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
; *** End added by AutoIt3Wrapper ***
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.15.0 (Beta)
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <Constants.au3>
#include <Zip.au3>
#include <File.au3>
#include <Array.au3>
#include <Console.au3>

$sevfile = ""
If Not FileExists ( "C:\Program Files\7-Zip\7z.exe" ) Then
    If Not FileExists ( "C:\Program Files (x86)\7-Zip\7z.exe" ) Then
        DirCreate ( @AppDataDir & "\7ziptemp" )
        $down = InetGet ( "http://d.7-zip.org/a/7za920.zip", @AppDataDir & "\7zip.zip" )
        InetClose ( $down )
        _Zip_UnzipAll ( @AppDataDir & "\7zip.zip", @AppDataDir & "\7ziptemp" )
        $sevfile = @AppDataDir & "\7ziptemp\7za.exe"
    Else
        $sevfile = "C:\Program Files (x86)\7-Zip\7z.exe"
    EndIf
Else
    $sevfile = "C:\Program Files\7-Zip\7z.exe"
EndIf
$comfile = _GetFilename ( $sevfile ) & "." & _GetFilenameExt ( $sevfile )
Cout ("")
While 1
$file = FileOpenDialog ( "Select the udf or the archive that contains it.", "", "AutoIT and Archive (*.au3;*.zip;*.rar;*.7z;*.dll)", 7 )
$selectedfiles = StringSplit ( $file, "|" )
If @error Then
    SetError ( 0 )
    If _GetFilenameExt ( $file ) = "au3" Or _GetFilenameExt ( $file ) = "dll" Then
        Cout ( "Copying " & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) & @CRLF )
        FileCopy ( $file, @ProgramFilesDir & "\AutoIt3\Include\" & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) )
        FileCopy ( $file, @ProgramFilesDir & "\AutoIt3\Beta\Include\" & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) )
    ElseIf _GetFilenameExt ( $file ) = "zip" Then
        $folder = _GetFilename ( $file )
        DirCreate ( @DesktopDir & "\" & $folder )
        Cout ( "Unzipping " & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) & @CRLF )
        _Zip_UnzipAll($file, @DesktopDir & "\" & $folder, 4 )
        $array = _FileListToArrayRec ( @DesktopDir & "\" & $folder, "*", $FLTAR_FILES, $FLTAR_RECUR )
        For $i = 1 To $array[0] Step 1
            Cout ( "Copying " & _GetFilename ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) & @CRLF )
            FileCopy ( @DesktopDir & "\" & $folder & "\" & $array[$i], @ProgramFilesDir & "\AutoIt3\Include\" & _GetFilename ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) )
            FileCopy ( @DesktopDir & "\" & $folder & "\" & $array[$i], @ProgramFilesDir & "\AutoIt3\Beta\Include\" & _GetFilename ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) )
        Next

    ElseIf _GetFilenameExt ( $file ) = "rar" Then
        $folder2 = _GetFilename ( $file )
        DirCreate ( @DesktopDir & "\" & $folder2 )
        Cout ( "Unzipping " & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) & @CRLF )
        RunWait(@ComSpec & ' /c ' & $comfile & ' x "' & $file & '" -o"' & @DesktopDir & '\' & $folder2 & '\"', _GetFilenamePath ( $sevfile ) )
        $array2 = _FileListToArrayRec ( @DesktopDir & "\" & $folder2, "*", $FLTAR_FILES, $FLTAR_RECUR )
        For $i = 1 To $array2[0] Step 1
            Cout ( "Copying " & _GetFilename ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) & @CRLF )
            FileCopy ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i], @ProgramFilesDir & "\AutoIt3\Include\" & _GetFilename ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) )
            FileCopy ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i], @ProgramFilesDir & "\AutoIt3\Beta\Include\" & _GetFilename ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) )
        Next
    ElseIf _GetFilenameExt ( $file ) = "7z" Then
        $folder3 = _GetFilename ( $file )
        DirCreate ( @DesktopDir & "\" & $folder3 )
        Cout ( "Unzipping " & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) & @CRLF )
        RunWait(@ComSpec & ' /c ' & $comfile & ' x "' & $file & '" -o"' & @DesktopDir & '\' & $folder3 & '\"', _GetFilenamePath ( $sevfile ) )
        $array3 = _FileListToArrayRec ( @DesktopDir & "\" & $folder3, "*", $FLTAR_FILES, $FLTAR_RECUR )
        For $i = 1 To $array3[0] Step 1
            Cout ( "Copying " & _GetFilename ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) & @CRLF )
            FileCopy ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i], @ProgramFilesDir & "\AutoIt3\Include\" & _GetFilename ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) )
            FileCopy ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i], @ProgramFilesDir & "\AutoIt3\Beta\Include\" & _GetFilename ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) )
        Next
    Else
        Cout ( "Unknown file type.  Skipping over " & $file & @CRLF )
    EndIf
Else
    For $t = 2 To $selectedfiles[0] Step 1
        $file =  $selectedfiles[1] & "\" & $selectedfiles[$t]
        If _GetFilenameExt ( $file ) = "au3" Or _GetFilenameExt ( $file ) = "dll" Then
            Cout ( "Copying " & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) & @CRLF )
            FileCopy ( $file, @ProgramFilesDir & "\AutoIt3\Include\" & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) )
            FileCopy ( $file, @ProgramFilesDir & "\AutoIt3\Beta\Include\" & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) )
        ElseIf _GetFilenameExt ( $file ) = "zip" Then
            $folder = _GetFilename ( $file )
            DirCreate ( @DesktopDir & "\" & $folder )
            Cout ( "Unzipping " & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) & @CRLF )
            _Zip_UnzipAll($file, @DesktopDir & "\" & $folder, 4 )
            $array = _FileListToArrayRec ( @DesktopDir & "\" & $folder, "*", $FLTAR_FILES, $FLTAR_RECUR )
            For $i = 1 To $array[0] Step 1
                Cout ( "Copying " & _GetFilename ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) & @CRLF )
                FileCopy ( @DesktopDir & "\" & $folder & "\" & $array[$i], @ProgramFilesDir & "\AutoIt3\Include\" & _GetFilename ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) )
                FileCopy ( @DesktopDir & "\" & $folder & "\" & $array[$i], @ProgramFilesDir & "\AutoIt3\Beta\Include\" & _GetFilename ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder & "\" & $array[$i] ) )
            Next

        ElseIf _GetFilenameExt ( $file ) = "rar" Then
            $folder2 = _GetFilename ( $file )
            DirCreate ( @DesktopDir & "\" & $folder2 )
            Cout ( "Unzipping " & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) & @CRLF )
            RunWait(@ComSpec & ' /c ' & $comfile & ' x "' & $file & '" -o"' & @DesktopDir & '\' & $folder2 & '\"', _GetFilenamePath ( $sevfile ) )
            $array2 = _FileListToArrayRec ( @DesktopDir & "\" & $folder2, "*", $FLTAR_FILES, $FLTAR_RECUR )
            For $i = 1 To $array2[0] Step 1
                Cout ( "Copying " & _GetFilename ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) & @CRLF )
                FileCopy ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i], @ProgramFilesDir & "\AutoIt3\Include\" & _GetFilename ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) )
                FileCopy ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i], @ProgramFilesDir & "\AutoIt3\Beta\Include\" & _GetFilename ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder2 & "\" & $array2[$i] ) )
            Next
        ElseIf _GetFilenameExt ( $file ) = "7z" Then
            $folder3 = _GetFilename ( $file )
            DirCreate ( @DesktopDir & "\" & $folder3 )
            Cout ( "Unzipping " & _GetFilename ( $file ) & "." & _GetFilenameExt ( $file ) & @CRLF )
            RunWait(@ComSpec & ' /c ' & $comfile & ' x "' & $file & '" -o"' & @DesktopDir & '\' & $folder3 & '\"', _GetFilenamePath ( $sevfile ) )
            $array3 = _FileListToArrayRec ( @DesktopDir & "\" & $folder3, "*", $FLTAR_FILES, $FLTAR_RECUR )
            For $i = 1 To $array3[0] Step 1
                Cout ( "Copying " & _GetFilename ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) & @CRLF )
                FileCopy ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i], @ProgramFilesDir & "\AutoIt3\Include\" & _GetFilename ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) )
                FileCopy ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i], @ProgramFilesDir & "\AutoIt3\Beta\Include\" & _GetFilename ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) & "." & _GetFilenameExt ( @DesktopDir & "\" & $folder3 & "\" & $array3[$i] ) )
            Next
        Else
            Cout ( "Unknown file type.  Leaving in folder." & @CRLF )
        EndIf
    Next
EndIf

Do
    Cout ( "Do you have anymore udfs to add?" & @CRLF & "[Y]es, [N]o?" & @CRLF )
    $resp = Getch ()
    Cout ( @CRLF )
Until $resp = "y" Or $resp = "n"
If $resp = "y" Then
    ContinueLoop
Else
    ExitLoop
EndIf

WEnd




Func _GetFilename($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.FileName
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilename

Func _GetFilenameExt($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.Extension
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenameExt

Func _GetFilenameInt($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.Name
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenameInt

Func _GetFilenameDrive($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return StringUpper($oObjectFile.Drive)
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenameDrive

Func _GetFilenamePath($sFilePath)
    Local $oWMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    Local $oColFiles = $oWMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($sFilePath, "\", "\\") & "'")
    If IsObj($oColFiles) Then
        For $oObjectFile In $oColFiles
            Return $oObjectFile.Path
        Next
    EndIf
    Return SetError(1, 1, 0)
EndFunc   ;==>_GetFilenamePath

This next one I wrote as a means to backup the contents of both "Include" folders should I screw something up while testing the above script.  It will create to txt files in Documents folder containing current backup of both includes folders when it is first run.  Any simultaneous run (as long as those files are present), will ask if you want to overwrite the files.  If not, then the script will once again scan the files in both Includes folders, compare the current contents to the contents read from the previously saved txt files, and present the user with a GUI containing two list boxes with the file names of extra files that were not present at the time the txt files were created.  The Gui also allows you to select items from each list and delete selected items, and also allows for the quick deletion of all extra files found:

; *** Start added by AutoIt3Wrapper ***
#include <FileConstants.au3>
#include <ListBoxConstants.au3>
#include <MsgBoxConstants.au3>
; *** End added by AutoIt3Wrapper ***
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.15.0 (Beta)
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <File.au3>
#include <Array.au3>
#include <Constants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>

If Not FileExists ( @MyDocumentsDir & "\current.txt" ) Then
    $array = _FileListToArray ( "C:\Program Files (x86)\AutoIt3\Include", "*", $FLTA_FILES )
    $array2 = _FileListToArray ( "C:\Program Files (x86)\AutoIt3\Beta\Include", "*", $FLTA_FILES )
    _FileWriteFromArray ( @MyDocumentsDir & "\current.txt", $array )
    _FileWriteFromArray ( @MyDocumentsDir & "\currentbeta.txt", $array2 )
Else
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox($MB_YESNOCANCEL + $MB_ICONQUESTION,"Already exist","The files already exist.  Do you want to overwrite?")
Select
    Case $iMsgBoxAnswer = $IDYES
        Do
            FileDelete ( @MyDocumentsDir & "\current.txt" )
            FileDelete ( @MyDocumentsDir & "\currentbeta.txt" )
        Until Not FileExists ( @MyDocumentsDir & "\current.txt" ) And Not FileExists ( @MyDocumentsDir & "\currentbeta.txt" )
        $file1 = FileSelectFolder ( "Select the include folder for reference.", "" )
        $file2 = FileSelectFolder ( "Select the beta include folder for reference.", "" )
        $array = _FileListToArray ( $file1, "*", $FLTA_FILES )
    $array2 = _FileListToArray ( $file2, "*", $FLTA_FILES )
    _FileWriteFromArray ( @MyDocumentsDir & "\current.txt", $array )
    _FileWriteFromArray ( @MyDocumentsDir & "\currentbeta.txt", $array2 )
    Case $iMsgBoxAnswer = $IDNO
        $array1 = FileReadToArray ( @MyDocumentsDir & "\current.txt" )
        $array2 = FileReadToArray ( @MyDocumentsDir & "\currentbeta.txt" )
        $array3 = _FileListToArray ( "C:\Program Files (x86)\AutoIt3\Include", "*", $FLTA_FILES )
        $array4 = _FileListToArray ( "C:\Program Files (x86)\AutoIt3\Beta\Include", "*", $FLTA_FILES )
        $string1 = ""
        $string2 = ""
        For $i = 1 To $array3[0] Step 1
            $res = _ArraySearch ( $array1, $array3[$i] )
            If @error Then
                SetError ( 0 )
                $string1 = $string1 & $array3[$i] & ";"
                ContinueLoop
            Else
                ContinueLoop
            EndIf
        Next
        $firstres = StringSplit ( StringTrimRight ( $string1, 1 ), ";" )
        For $i = 1 To $array4[0] Step 1
            $res2 = _ArraySearch ( $array2, $array4[$i] )
            If @error Then
                SetError ( 0 )
                $string2 = $string2 & $array4[$i] & ";"
                ContinueLoop
            Else
                ContinueLoop
            EndIf
        Next
        $secondres = StringSplit ( StringTrimRight ( $string2, 1 ), ";" )
        myGUI ( $firstres, $secondres )
    Case $iMsgBoxAnswer = $IDCANCEL
        Exit
EndSelect
EndIf
Func myGUI ( ByRef $inarray, ByRef $inarray2)
#Region ### START Koda GUI section ### Form=C:\Users\whiggs\OneDrive\always script\form\includecomp.kxf
$Form1 = GUICreate("Form1", 443, 370, 192, 124)
$Label1 = GUICtrlCreateLabel("Include", 72, 32, 67, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$List1 = GUICtrlCreateList("", 24, 64, 177, 201, BitOR($GUI_SS_DEFAULT_LIST,$LBS_MULTIPLESEL,$LBS_HASSTRINGS))
For $u = 1 To $inarray[0] Step 1
    GUICtrlSetData ( -1, $inarray[$u] )
Next
$Label2 = GUICtrlCreateLabel("Beta Include", 272, 32, 112, 29)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$List2 = GUICtrlCreateList("", 240, 64, 177, 201, BitOR($GUI_SS_DEFAULT_LIST,$LBS_MULTIPLESEL,$LBS_HASSTRINGS))
For $u = 1 To $inarray2[0] Step 1
    GUICtrlSetData ( -1, $inarray2[$u] )
Next
$Button1 = GUICtrlCreateButton("OK", 40, 312, 81, 33, $BS_NOTIFY)
GUICtrlSetCursor (-1, 0)
$Button2 = GUICtrlCreateButton("Delete Selected", 160, 312, 89, 33, $BS_NOTIFY)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetCursor (-1, 0)
$Button3 = GUICtrlCreateButton("Delete all", 288, 312, 89, 33, $BS_NOTIFY)
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $List1
            If _GUICtrlListBox_GetSelCount ( $List1 ) = -1 And _GUICtrlListBox_GetSelCount ( $List2 ) = -1 Then
                GUICtrlSetState($Button2, $GUI_DISABLE)
            Else
                GUICtrlSetState($Button2, $GUI_ENABLE)
            EndIf
        Case $List2
            If _GUICtrlListBox_GetSelCount ( $List1 ) = -1 And _GUICtrlListBox_GetSelCount ( $List2 ) = -1 Then
                GUICtrlSetState($Button2, $GUI_DISABLE)
            Else
                GUICtrlSetState($Button2, $GUI_ENABLE)
            EndIf
        Case $Button1
            Exit
        Case $Button2
            If _GUICtrlListBox_GetSelCount ( $List1 ) <> -1 Then
                $del = _GUICtrlListBox_GetSelItemsText ( $List1 )
            EndIf
            If _GUICtrlListBox_GetSelCount ( $List2 ) <> -1 Then
                $del2 = _GUICtrlListBox_GetSelItemsText ( $List2 )
            EndIf
            If IsDeclared ( "del" ) Then
                For $t = 1 To $del[0] Step 1
                    Do
                        FileDelete ( "C:\Program Files (x86)\AutoIt3\Include\" & $del[$t] )
                    Until Not FileExists ( "C:\Program Files (x86)\AutoIt3\Include\" & $del[$t] )
                Next
            EndIf
            If IsDeclared ( "del2" ) Then
                For $t = 1 To $del2[0] Step 1
                    Do
                        FileDelete ( "C:\Program Files (x86)\AutoIt3\Beta\Include\" & $del2[$t] )
                    Until Not FileExists ( "C:\Program Files (x86)\AutoIt3\Beta\Include\" & $del2[$t] )
                Next
            EndIf
            Exit
        Case $Button3
            For $t = 0 To _GUICtrlListBox_GetCount ( $List1 ) - 1 Step 1
                $text = _GUICtrlListBox_GetText ( $List1, $t )
                Do
                    FileDelete ( "C:\Program Files (x86)\AutoIt3\Include\" & $text )
                Until Not FileExists ( "C:\Program Files (x86)\AutoIt3\Include\" & $text )
            Next
            For $t = 0 To _GUICtrlListBox_GetCount ( $List2 ) - 1 Step 1
                $text = _GUICtrlListBox_GetText ( $List2, $t )
                Do
                    FileDelete ( "C:\Program Files (x86)\AutoIt3\Beta\Include\" & $text )
                Until Not FileExists ( "C:\Program Files (x86)\AutoIt3\Beta\Include\" & $text )
            Next
            Exit
    EndSwitch
WEnd
EndFunc

Will need attached udfs.  Have at it.

Edit: Oh, I almost forgot.  Thanks guinness, for the File "dissection" functions in the first script.  Don't remember where I saw, just remember you wrote them.

Zip.au3

Console.au3

Edited by MattHiggs

Share this post


Link to post
Share on other sites



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