Jump to content
Sign in to follow this  

Utilities collection

Recommended Posts


this neat program has 4 inbuilt programs, this is the list as it appears

-V2 players, you will know what i am on about here (Aranock, Thule, Mercadia, etc) a random number generator for death rulettes, this may just be your ticket to a winning day

-File Maker, premake any file of your choosing, much easier than using notepad to premake your files for use

-Error Recorder, record an error from any error window, just type in the title of that window, then you can post it to a support forum for that program to find out what caused that error, note that any successful recording will have OK at the start of the file when you open it

-Empty directory remover, thanks to KaFu for the code, allows you to remove those annoying empty directories

special features:

-file maker, error recorder and directory remover feature a find directory function for saving of the results files or setting the start directory of the empty directory remover

-empty directory remover makes a results file of all directories removed to the desktop, so you know exactly what directories are being removed

-if you choose your main drive as the start directory for the directory remover, it will search that entire drive for empty directories, only takes 1 minute to 5 minutes depending how many directories/folders you have

-features a credits window when "Exit" is pressed

please if i have missed anyone for thanking to help make this, let me know

and after some deep consideration, i realized that theres nothing wrong with posting the code, so here it is ^_^

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiButton.au3>
#include <File.au3>
#include <array.au3>

$gui=GUICreate("Utilities Collection")
GUISetState(@SW_SHOW, $gui)
$Button1=GUICtrlCreateButton("Exit", 346, 5, 50, 25)
$Button2=GUICtrlCreateButton("Random number", 5, 5, 100, 25)
GUICtrlCreateLabel("creates a random number between and including 1 and 5500" & @lf & "for Death Rulettes in the V2 clone", 5, 30)
$Button3=GUICtrlCreateButton("File Maker", 5, 70, 100, 25)
GUICtrlCreateLabel("Creates a file with any extension, perfect for premaking a script, config or text file", 5, 95) 
$Button4=GUICtrlCreateButton("Record an error", 5, 125, 100, 25)
GUICtrlCreateLabel("Records an error from a window as a file", 5, 150)
$Button5=GUICtrlCreateButton("Empty directory remover", 5, 175, 150, 25)
GUICtrlCreateLabel("Delete empty directories from any folder, includes sub dirs", 5, 200)

While 1
        $msg = GUIGetMsg()
        Switch $msg
        Case $Button1
        MsgBox(0, "Note From Author", "Thankyou for using my utilities collection" & @lf & @lf & "Special Thanks to:" & @lf & @lf & "KaFu:" & @LF & "code for empty directory remover")
        Case $Button2
        Case $Button3
        case $Button4
        Case $Button5
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Func randomnumber()
$LowerLimit = 1
$UpperLimit = 5500

$RandomNumber = Random($LowerLimit,$UpperLimit,1)

$randgui=GUICreate("RandomNumber", 100, 100)
GUICtrlCreateLabel($RandomNumber, 40, 5)
$Button1=GUICtrlCreateButton("Next", 20, 45)
$Button2=GUICtrlCreateButton("Exit", 60, 45)

While 1
        $msg = GUIGetMsg()
        Switch $msg
        Case $Button1
    Case $Button2, $GUI_EVENT_CLOSE
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Func Filemake()
    $input=inputBox("File Maker", "what file would you like to create?" & @lf & @lf & "Example: something.txt" & @lf & @lf & "Next window will let you choose where to save the file")

_FileCreate(FileSelectFolder("Save file to:", "", 7) & "\" & $input)

Func troubleshootWin()
$window=InputBox("error logger", "what is the title of the window appearing with the error?" & @lf & "Please type it exactly as you see the title, example: BiTComet or BITCOMET or bitcomet is not the same as BitComet")
$file=InputBox("Save Error As","what would you like to save the error recorded as?" & @lf & @lf & "Example: error.txt" & @lf & @lf & "Next window will let you choose" & @lf & "where to save the file")
$fsave=FileSelectFolder("Save error file to:", "", 7)

_FileCreate($fsave & "\" & $file)
FileWriteLine($fsave & "\" & $file, $RecError)

Func emptydirectoryrem()
    $ddnumber = 0
    _FileCreate(@desktopdir & "\empty directory removal results.txt")

$var = FileSelectFolder("Delete Empty directories from:", "", 7)
If @error Then Exit

$FileList = RecursiveFileSearch($var, "", "", 2, True)
If @error = 1 Then
    MsgBox(0, "", "No Files\Folders Found.")


For $i = 1 To $FileList[0]
    If StringInStr(FileGetAttrib($FileList[$i]), "D") Then; If parent (empty) dir has already been deleted, FileGetAttrib returns Blank and further analysis is skiped.
        If DirGetSize($FileList[$i]) = 0 Then
            If DirRemove($FileList[$i]) Then
                ConsoleWrite("Dir removed: " & $FileList[$i] & @CRLF)
                $ddnumber += 1
                FileWriteLine(@desktopdir & "\empty directory removal results.txt", $FileList[$i] & @CRLF)
                ConsoleWrite("Could not remove (empty?) dir: " & $FileList[$i] & @CRLF)
            ConsoleWrite("Dir not removed (contains files): " & $FileList[$i] & @CRLF)

If $ddnumber = 0 Then
    MsgBox(0, "No empty directories", "No empty directories found")
    MsgBox(0, "Results", $ddnumber & " empty directories removed, please see 'empty directory removal results.txt' on the desktop")

Func RecursiveFileSearch($RFSstartDir, $RFSFilepattern = ".", $RFSFolderpattern = ".", $RFSFlag = 0, $RFSrecurse = True, $RFSdepth = 0)

;Ensure starting folder has a trailing slash
    If StringRight($RFSstartDir, 1) <> "\" Then $RFSstartDir &= "\"

    If $RFSdepth = 0 Then
    ;Get count of all files in subfolders for initial array definition
        $RFSfilecount = DirGetSize($RFSstartDir, 1)

    ;File count + folder count (will be resized when the function returns)
        Global $RFSarray[$RFSfilecount[1] + $RFSfilecount[2] + 1]

    $RFSsearch = FileFindFirstFile($RFSstartDir & "*.*")
    If @error Then Return

;Search through all files and folders in directory
    While 1
        $RFSnext = FileFindNextFile($RFSsearch)
        If @error Then ExitLoop

    ;If folder and recurse flag is set and regex matches
        If StringInStr(FileGetAttrib($RFSstartDir & $RFSnext), "D") Then

            If $RFSrecurse And StringRegExp($RFSnext, $RFSFolderpattern, 0) Then
                RecursiveFileSearch($RFSstartDir & $RFSnext, $RFSFilepattern, $RFSFolderpattern, $RFSFlag, $RFSrecurse, $RFSdepth + 1)
                If $RFSFlag <> 1 Then
                ;Append folder name to array
                    $RFSarray[$RFSarray[0] + 1] = $RFSstartDir & $RFSnext
                    $RFSarray[0] += 1
        ElseIf StringRegExp($RFSnext, $RFSFilepattern, 0) And $RFSFlag <> 2 Then
        ;Append file name to array
            $RFSarray[$RFSarray[0] + 1] = $RFSstartDir & $RFSnext
            $RFSarray[0] += 1

    If $RFSdepth = 0 Then
        ReDim $RFSarray[$RFSarray[0] + 1]
        Return $RFSarray
EndFunc  ;==>RecursiveFileSearch

if you have any suggestions for further Utilities, let me know

here is the download link for the already compiled application (Utils.exe)



all feedback appreciated

Downloads: 10

Edited by snowman533

Intermediate AutoIt/Autohotkey User

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
Sign in to follow this