Jump to content
Sign in to follow this  
RagnaroktA

$GUI_DISABLE Error: Variable used without being declared

Recommended Posts

RagnaroktA

Okay so I'm a bit confused... The imbedded script works just fine when running from my Scripting IDE, or running without compiling.

As soon as I compile (using either beta, or latest release) when I run the script I get the following:

Posted Image

What?

#Region --- Header ---
#comments-start
    Title:          Batch Print Wizard
    Filename:       Batch Print.au3
    Description:    Tool to aid in the batch printing of files.
    Author(s):      Scott Forehand (RagnaroktA) stforehand@gmail.com
    Version:        2.0
    Last Update:    5/15/2007
    Requirements:   AutoIt v3.2 +, Developed/Tested on WindowsXP Professional Service Pack 2
    Notes:          
#comments-end
#EndRegion --- Header ---

#Region --- Compiler Directives ---
;** This is a list of compiler directives used by CompileAU3.exe.
;** comment the lines you don't need or else it will override the default settings
    ; #Compiler_Prompt=y                                      ; y=show compile menu
;** AUT2EXE settings
    ; #Compiler_AUT2EXE=
        #Compiler_Icon="""F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Batch Print.ico"""                ; Filename of the Ico file to use
    ; #Compiler_OutFile=                                      ; Target exe filename.
    ; #Compiler_OutFile_Type=                               ; a3x=small AitoIt3 file;  exe=Standalone executable(Default)
        #Compiler_Compression=4                             ; Compression parameter 0-4  0=Low 2=normal 4=High
        #Compiler_Allow_Decompile=y                           ; y=allow decompile
    ; #Compiler_PassPhrase=                             ; Password to use for compilation
;** Target program Resource info
        #Compiler_Res_Comment=Tool to aid in the batch printing of files.
        #Compiler_Res_Description=
        #Compiler_Res_Fileversion=2.0
    ; #Compiler_Res_LegalCopyright=
; Free form resource fields ... max 15
    ; #Compiler_Res_Field=Email|                             ; Free format fieldname|fieldvalue (custompcs@charter.net)
        #Compiler_Res_Field=Release Date|1/11/2007            ; Free format fieldname|fieldvalue
        #Compiler_Res_Field=Update Date|5/15/2007               ; Free format fieldname|fieldvalue
        #Compiler_Res_Field=Internal Name|Batch Print.exe       ; Free format fieldname|fieldvalue
        #Compiler_Res_Field=Status|                             ; Free format fieldname|fieldvalue
; AU3CHECK settings
        #Compiler_Run_AU3Check=y                                ; Run au3check before compilation
        #Compiler_AU3Check_Dat=                               ; Override the default au3check definition
; RUN BEFORE AND AFTER definitions
; The following directives can contain:
; %in% , %out%, %icon% which will be replaced by the fullpath\filename.
; %scriptdir% same as @ScriptDir and %scriptfile% = filename without extension.
        #Compiler_Run_Before=                               ; Process to run before compilation - you can have multiple records that will be processed in sequence
    ; #Compiler_Run_After=move '%out%' '%scriptdir%'          ; Process to run after compilation - you can have multiple records that will be processed in sequence
        #Compiler_Run_After=move """F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Batch Print.exe""" """F:\Development Library\AutoIt\Projects\Batch Print\Compiled"""; process to run after compilation - you can have multiple records that will be processed in sequence
#EndRegion --- Compiler Directives End ---

#Region --- Includes ---
;----- Standard Includes -----
    #include <GuiConstants.au3>
    #include <GuiListView.au3>
    #include <Misc.au3>
    #include <Inet.au3>
    #include <File.au3>
    #include <Constants.au3>
    #include <Array.au3>

;----- Non-Standard Includes -----

#EndRegion --- Includes ---

#Region --- Globals, Variables, and Constants ---
    Global $G_MY_FIRSTCTRLID    = 5000
    Global $G_MY_LASTCTRLID     = 6000
    Global $G_MY_CTRLID         = $G_MY_FIRSTCTRLID
    Global $sTitle              = 'Batch Print Wizard'
    Global $sVersion            = '2.0'
    Global $sBuild              = ''
    Global $sHelpFile           = FileGetShortName(@UserProfileDir & '\Application Data\Batch Print\Batch Print Help.chm')

    Global $iGUI, $sF1Destination, $sF2Destination, $sF3Destination, $sF4Destination, $sF5Destination, $cGUIProgressBar, $iSuccessful, $iFailed, $lvEven = 1

    Global $picBatchPrint           = @UserProfileDir & '\Application Data\Batch Print\Batch Print.jpg'
    Global $picBatchPrintLogo       = @UserProfileDir & '\Application Data\Batch Print\Batch Print Logo.jpg'
    Global $sSuccessfulIcon         = @UserProfileDir & '\Application Data\Batch Print\Successful Print.ico'
    Global $sFailedIcon             = @UserProfileDir & '\Application Data\Batch Print\Failed Print.ico'

    Global $sGUI1Description        = 'This wizard helps you batch print all of the files in the directory specified. The files will print to your Default Printer.'
    Global $sGUI1Description2       = 'To continue, click Next.'
    Global $sGUI2Note               = 'You may batch print files from one or more directories.'
    Global $sGUI3Note               = ''
    Global $sGUIFinishDescription   = 'You have successfully completed the ' & $sTitle & '. ' & @CRLF & @CRLF & 'Successfully Printed ' & $iSuccessful & ' Files.' & _
                                    @CRLF & 'Failed to Print ' & $iFailed & ' Files.' & @CRLF & @CRLF & 'To immediately print files in another directory, check the checkbox below to restart the wizard.'
    Global $sGUIFinishDescription2  = 'To complete this wizard, click Finish.'

    Global Const $cursor_WAIT       = 15
    Global Const $cursor_ARROW      = 2
    Global Const $GUIBkColor        = 0xCCCCCC; Sets GUI background color to light gray

    #Region --- GUI 1 Creation Declares ---
        Global $hGUI, $hGUI1Dummy1, $sGUI1Description, $sGUI1Description2, $btnGUIHelp, $btnGUIBack, $btnGUINext, $btnGUICancel, $hGUI1Dummy2
    #EndRegion --- GUI 1 Creation Declares ---

    #Region --- GUI 2 Creation Declares ---
        Global $hGUI2Dummy1, $lblGUI2Header, $lblGUI2HeaderMessage, $picGUI2HeaderPic, $sGUI2Note, $hGUI2Dummy2, $ibGUI2Directory1, $btnGUI2Directory1Browse, $ibGUI2Directory2, $btnGUI2Directory2Browse, $ibGUI2Directory3, $btnGUI2Directory3Browse, $ibGUI2Directory4, $btnGUI2Directory4Browse, $ibGUI2Directory5, $btnGUI2Directory5Browse
    #EndRegion --- GUI 2 Creation Declares ---

    #Region --- GUI 3 Creation Declares ---
        Global $hGUI3Dummy1, $lblGUI3Header, $lblGUI3HeaderMessage, $picGUI3HeaderPic, $lvFiles, $lblGUIMainText, $lblGUISubText, $cGUIProgressBar, $hGUI3Dummy2
    #EndRegion --- GUI 3 Creation Declares ---

    #Region --- GUI Finish Creation Declares ---
        Global $hGUIFinishDummy1, $btnGUIFinish, $ckbGUIFinishRunAgain, $hGUIFinishDummy2   
    #EndRegion --- GUI Finish Creation Declares ---

#EndRegion --- Globals, Variables, and Constants ---

#Region --- Options ---
    #NoTrayIcon
    Opt('GUICoordMode', 1)          ;1 = Absolute coordinates / 0 = Relative position to the start of the last control / 2 = Cell positionining relative to current cell
    Opt('GUIOnEventMode', 1)        ;1 = Enable Enables OnEvent functions notifications / 0 = Disable (Default) Disables OnEvent functions notifications
    Opt('MustDeclareVars', 0)       ;1 = Variables must be pre-declared / 0 = Variables don't need to be pre-declared (Default)
    Opt('RunErrorsFatal', 0)        ;1 = Fatal set / 0 = Silent set @error
    Opt('GUICloseOnESC', 0)         ;1 = ESC  closes / 0 = ESC won't close
    Opt('GUIResizeMode', 1)         ;0 = No resizing / <1024 Special resizing
    Opt('OnExitFunc','OnAutoItExit');'OnAutoItExit' called
    Opt('TrayOnEventMode',1)
    Opt('TrayMenuMode',1)
#EndRegion --- Options ---

#Region --- GUI Preprocessing ---
    _CheckRunning('627452103', $sTitle)
    _CheckAdmin()
    _GUIPrep()
;   _CreateINI()
;   _ReadINI()
;   TCPStartup()
#EndRegion --- GUI Preprocessing ---

#Region --- GUI Creation ---
    #Region --- GUI 1 ---
        $hGUI = GUICreate($sTitle, 500, 365)
            GUISetIcon('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Batch Print.ico')

        $hGUI1Dummy1 = GUICtrlCreateDummy()
            $iGUI = 'GUI1'
            GUICtrlCreatePic($picBatchPrint, 0, 0, 170, 318)
            GUICtrlCreateLabel($sTitle, 185, 10, 300, 30)
                GUICtrlSetFont(-1, 10, 650)
            GUICtrlCreateLabel($sGUI1Description, 185, 35, 300, 295)
            GUICtrlCreateLabel($sGUI1Description2, 185, 295, 300, 20)
        $hGUI1Dummy2 = GUICtrlCreateDummy()

        GUICtrlCreateGroup('', -2, 312, 508, 100)
        GUICtrlCreateGroup('', -99, -99, 1, 1); Close Group

        $btnGUIHelp = GUICtrlCreateButton('&Help', 10, 331, 75, 24)

        $btnGUIBack = GUICtrlCreateButton('< &Back', 254, 331, 75, 24)
            GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
        $btnGUINext = GUICtrlCreateButton('&Next >', 330, 331, 75, 24, $BS_DEFPUSHBUTTON)
            GUICtrlSetState($btnGUINext, $GUI_FOCUS)
        $btnGUICancel = GUICtrlCreateButton('&Cancel', 415, 331, 75, 24)
    #EndRegion --- GUI 1 ---

    #Region --- GUI 2 ---
        $hGUI2Dummy1 = GUICtrlCreateDummy()
            GUICtrlCreateLabel('', 0, 0, 500, 62)
                GUICtrlSetBkColor(-1, '0xFFFFFF')
            GUICtrlCreateLabel('Choose the directories.', 10, 10, 300, 30)
                GUICtrlSetFont(-1, 10, 600)
                GUICtrlSetBkColor(-1, '0xFFFFFF')
            GUICtrlCreatePic($picBatchPrintLogo, 436, 4, 60, 54)
            GUICtrlCreateGroup('', -4, -8, 508, 70)
            GUICtrlCreateGroup('', -99, -99, 1, 1); Close Group


            $ibGUI2Directory1 = GUICtrlCreateInput('', 60, 80, 300, 23)
            $btnGUI2Directory1Browse = GUICtrlCreateButton('Bro&wse...', 365, 80, 75, 23)

            $ibGUI2Directory2 = GUICtrlCreateInput('', 60, 110, 300, 23)
            $btnGUI2Directory2Browse = GUICtrlCreateButton('Bro&wse...', 365, 110, 75, 23)

            $ibGUI2Directory3 = GUICtrlCreateInput('', 60, 140, 300, 23)
            $btnGUI2Directory3Browse = GUICtrlCreateButton('Bro&wse...', 365, 140, 75, 23)

            $ibGUI2Directory4 = GUICtrlCreateInput('', 60, 170, 300, 23)
            $btnGUI2Directory4Browse = GUICtrlCreateButton('Bro&wse...', 365, 170, 75, 23)

            $ibGUI2Directory5 = GUICtrlCreateInput('', 60, 200, 300, 23)
            $btnGUI2Directory5Browse = GUICtrlCreateButton('Bro&wse...', 365, 200, 75, 23)

            GUICtrlCreateLabel('Note:', 50, 270, 30, 20)
                GUICtrlSetColor(-1,0xFF0000)
            GUICtrlCreateLabel($sGUI2Note, 80, 270, 400, 20)

        $hGUI2Dummy2 = GUICtrlCreateDummy()
    #EndRegion --- GUI 2 ---

    #Region --- GUI 3 ---
        $hGUI3Dummy1 = GUICtrlCreateDummy()
            GUICtrlCreateLabel('', 0, 0, 500, 62)
                GUICtrlSetBkColor(-1, '0xFFFFFF')
            GUICtrlCreateLabel('Print the files.', 10, 10, 300, 30)
                GUICtrlSetFont(-1, 10, 600)
                GUICtrlSetBkColor(-1, '0xFFFFFF')
            GUICtrlCreatePic($picBatchPrintLogo, 436, 4, 60, 54)
            GUICtrlCreateGroup('', -4, -8, 508, 70)
            GUICtrlCreateGroup('', -99, -99, 1, 1); Close Group

            $lvFiles = GUICtrlCreateListView('No.|Directory|File', 60, 80, 380, 140)
                GUICtrlSendMsg($lvFiles, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
                GUICtrlSendMsg($lvFiles, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
                _GUICtrlListViewSetColumnWidth ($lvFiles, 0, 36)
                _GUICtrlListViewSetColumnWidth ($lvFiles, 1, 190)
                _GUICtrlListViewSetColumnWidth ($lvFiles, 2, 150)

        $hGUI3Dummy2 = GUICtrlCreateDummy()
    #EndRegion --- GUI 3 ---

    #Region --- GUI Finish ---
        $hGUIFinishDummy1 = GUICtrlCreateDummy()
            GUICtrlCreatePic($picBatchPrint, 0, 0, 170, 318)
            GUICtrlCreateLabel($sTitle, 185, 10, 300, 30)
                GUICtrlSetFont(-1, 10, 650)
            GUICtrlCreateLabel($sGUIFinishDescription, 185, 35, 300, 100)
            $ckbGUIFinishRunAgain = GUICtrlCreateCheckbox('Run the wizard again', 185, 180, 300, 20)
            GUICtrlCreateLabel($sGUIFinishDescription2, 185, 295, 300, 20)
        $hGUIFinishDummy2 = GUICtrlCreateDummy()
    #EndRegion --- GUI Finish ---

;   #Region --- GUI Template ---
;       $hGUICFDummy1 = GUICtrlCreateDummy()
;           GUICtrlCreateLabel('', 0, 0, 500, 62)
;               GUICtrlSetBkColor(-1 , '0xFFFFFF')
;           GUICtrlCreateLabel('Define custom settings.', 10, 10, 300, 30)
;               GUICtrlSetFont (-1, 10, 600)
;               GUICtrlSetBkColor(-1 , '0xFFFFFF')
;           GUICtrlCreatePic($picBatchPrintLogo, 436, 4, 60, 54)
;           GUICtrlCreateGroup('', -4, -8, 508, 70)
;           GUICtrlCreateGroup('', -99, -99, 1, 1); Close Group
;       $hGUICFDummy2 = GUICtrlCreateDummy()
;   #EndRegion --- GUI Template ---

; Set GUI Events

    GUICtrlSetOnEvent($btnGUIHelp, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUIBack, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUINext, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUICancel, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory1Browse, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory2Browse, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory3Browse, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory4Browse, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory5Browse, '_GUIEventHandler')

    GUISetOnEvent($GUI_EVENT_CLOSE, '_SysEventHandler', $hGUI)
        
    GUIChangeItems($hGUI2Dummy1, $hGUI2Dummy2, '', '')
    GUIChangeItems($hGUI3Dummy1, $hGUI3Dummy2, '', '')
    GUIChangeItems($hGUIFinishDummy1, $hGUIFinishDummy2, '', '')

    GUISetState()
#EndRegion --- --- GUI Creation ---

While 1
    Sleep(20)
    If $iGUI = 'GUI3' Then
        _Print()
    Endif
Wend

#Region --- Process Events ---
    Func _GUIEventHandler()
        Switch @GUI_CtrlId
            Case $btnGUICancel
                _TerminateWizard($hGUI)

            Case $btnGUIHelp
                If FileExists($sHelpFile) Then
                    Run(@ComSpec & " /c " & $sHelpFile, "", @SW_HIDE)
                Else
                    Msgbox(48, $sTitle, "Unable To Locate Help File!")
                Endif

            Case $btnGUIBack
                If $iGUI = 'GUI1' Then
                    
                Elseif $iGUI = 'GUI2' Then
                    $iGUI = 'GUI1'
                    GUIChangeItems($hGUI2Dummy1, $hGUI2Dummy2, $hGUI1Dummy1, $hGUI1Dummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
                Elseif $iGUI = 'GUI3' Then
                    $iGUI = 'GUI2'
                    GUIChangeItems($hGUI3Dummy1, $hGUI3Dummy2, $hGUI2Dummy1, $hGUI2Dummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
;               Elseif $iGUI = 'GUIFinish' Then
;                   $iGUI = 'GUI3'
;                   GUIChangeItems($hGUIFinishDummy1, $hGUIFinishDummy2, $hGUI3Dummy1, $hGUI3Dummy2)
;                   GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
                Else
                Endif

            Case $btnGUINext
                If $iGUI = 'GUI1' Then
                    $iGUI = 'GUI2'
                    GUIChangeItems($hGUI1Dummy1, $hGUI1Dummy2, $hGUI2Dummy1, $hGUI2Dummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_ENABLE)
                Elseif $iGUI = 'GUI2' Then
                    $iGUI = 'GUI3'
                    GUIChangeItems($hGUI2Dummy1, $hGUI2Dummy2, $hGUI3Dummy1, $hGUI3Dummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_ENABLE)
                Elseif $iGUI = 'GUI3' Then
                    $iGUI = 'GUIFinish'
                    GUIChangeItems($hGUI2Dummy1, $hGUI2Dummy2, $hGUIFinishDummy1, $hGUIFinishDummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
                    GUICtrlSetState($btnGUINext, $GUI_HIDE)
                    GUICtrlSetState($btnGUIFinish, $GUI_SHOW)
                    GUICtrlSetState($btnGUICancel, $GUI_DISABLE)
                Else
                    _TerminateApp()
                Endif

            Case $btnGUI2Directory1Browse
                $sF1Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF1Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory1, $sF1Destination)
                EndIf

            Case $btnGUI2Directory2Browse
                $sF2Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF2Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory2, $sF2Destination)
                EndIf

            Case $btnGUI2Directory3Browse
                $sF3Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF3Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory3, $sF3Destination)
                EndIf

            Case $btnGUI2Directory4Browse
                $sF4Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF4Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory4, $sF4Destination)
                EndIf

            Case $btnGUI2Directory5Browse
                $sF5Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF5Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory5, $sF5Destination)
                EndIf
        EndSwitch
    EndFunc; ==> _GUIEventHandler

    Func _SysEventHandler()
        Switch @GUI_CtrlId
            Case $GUI_EVENT_CLOSE
                _TerminateWizard(@GUI_WinHandle)

            Case $GUI_EVENT_MINIMIZE
            Case $GUI_EVENT_RESTORE
            Case $GUI_EVENT_MAXIMIZE
            Case $GUI_EVENT_PRIMARYDOWN
            Case $GUI_EVENT_PRIMARYUP
            Case $GUI_EVENT_SECONDARYDOWN
            Case $GUI_EVENT_SECONDARYUP
            Case $GUI_EVENT_MOUSEMOVE
            Case $GUI_EVENT_RESIZED
            Case $GUI_EVENT_DROPPED
        EndSwitch
    EndFunc; ==> _SysEventHandler
#EndRegion --- Process Events ---

#Region --- Check Running ---
    Func _CheckRunning($sSemaphore, $sProgramName);_CheckRunning('123456789', $sTitle); Creates A Unique Value
        DllCall('kernel32.dll', 'int', 'CreateSemaphore', 'int', 0, 'long', 1, 'long', 1, 'str', $sSemaphore)
        Local $lastError = DllCall('kernel32.dll', 'int', 'GetLastError'), $ERROR_ALREADY_EXISTS = 183
    
        If $lastError[0] = $ERROR_ALREADY_EXISTS Then
            Local $nRunning = MsgBox(16+4, $sProgramName, 'An instance of this program is already running! Would you like to open a new instance?')
                If $nRunning = 6 Then
                ; Do Nothing, Open New Instance
                Else
                    _TerminateApp()
                Endif
            AutoItWinSetTitle($sProgramName)
            WinActivate($sProgramName)
        EndIf
        _ReleaseMemory()
    EndFunc; ==> _CheckRunning
#EndRegion --- Check Running ---

#Region --- Check Administrative Privileges ---
    Func _CheckAdmin()
        If Not IsAdmin() Then
            MsgBox(48, $sTitle, 'The current account does not have administrative privileges on this machine.' & @CRLF & @CRLF & 'This wizard will now exit.')
            _TerminateApp()
        Endif
    EndFunc; ==> _CheckAdmin
#EndRegion --- Check Administrative Privileges ---

#Region --- GUI Functions ---
    Func _GUIPrep()
        If Not FileExists(@UserProfileDir & '\Application Data\Batch Print') Then DirCreate(@UserProfileDir & '\Application Data\Batch Print')
        FileInstall('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Batch Print.jpg', @UserProfileDir & '\Application Data\Batch Print\Batch Print.jpg')
        FileInstall('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Batch Print Logo.jpg', @UserProfileDir & '\Application Data\Batch Print\Batch Print Logo.jpg')
        FileInstall('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Successful Print.ico', @UserProfileDir & '\Application Data\Batch Print\Successful Print.ico')
        FileInstall('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Failed Print.ico', @UserProfileDir & '\Application Data\Batch Print\Failed Print.ico')

        If @Compiled Then
            Sleep(1000)
        EndIf
    EndFunc; ==> _GUIPrep

    Func GUIChangeItems($StartHide, $EndHide, $StartShow, $EndShow)
        Local $iDX
        
        For $iDX = $StartHide To $EndHide
            GUICtrlSetState ($iDX, $GUI_HIDE)
        Next
        For $iDX = $StartShow To $EndShow
            GUICtrlSetState ($iDX, $GUI_SHOW)
        Next    
    EndFunc

    Func _ReleaseMemory()
        Local $aiReturn = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
        Return $aiReturn[0]
    EndFunc; ==> _ReleaseMemory

    Func _ProgressOn(ByRef $s_mainlabel, ByRef $s_sublabel, ByRef $s_control, $s_main, $s_sub, $x, $y, $fSmooth = 0)
        $s_mainlabel = GUICtrlCreateLabel($s_main, $x, $y, StringLen($s_main) * 10, 20)
        If $s_mainlabel = 0 Then
            SetError(1)
            Return 0
        EndIf
        GUICtrlSetFont($s_mainlabel, 10, 600)
        If StringInStr(@OSTYPE, "WIN32_NT") And $fSmooth = 1 Then
            $prev = DllCall("uxtheme.dll", "int", "GetThemeAppProperties");, "int", 0)
            DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        EndIf
        $s_control = GUICtrlCreateProgress($x, $y + 20, 380, 20, $PBS_SMOOTH)
        If StringInStr(@OSTYPE, "WIN32_NT") And $fSmooth = 1 Then
            DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $prev[0])
        EndIf
        If $s_control = 0 Then
            SetError(1)
            Return 0
        EndIf
        $s_sublabel = GUICtrlCreateLabel($s_sub, $x, $y + 45)
        If $s_sublabel = 0 Then
            SetError(1)
            Return 0
        EndIf
        Dim $a_info[5]
        $a_info[0] = $s_control
        $a_info[1] = $s_mainlabel
        $a_info[2] = $s_sublabel
        $a_info[3] = $x
        $a_info[4] = $y
        Return $a_info
    EndFunc; ==> _ProgressOn

    Func _ProgressSet($a_info, $i_per, $s_sub = "", $s_main = "")
        If $s_main = "" Then $s_main = GUICtrlRead($a_info[1])
        If $s_sub = "" Then $s_sub = GUICtrlRead($a_info[2])
        $set1 = GUICtrlSetData($a_info[0], $i_per)
        $set2 = GUICtrlSetData($a_info[1], $s_main)
        $set3 = GUICtrlSetData($a_info[2], $s_sub)
        GUICtrlSetPos($a_info[2], $a_info[3], $a_info[4]+45, StringLen($s_sub)*6)
        GUICtrlSetPos($a_info[1], $a_info[3], $a_info[4], StringLen($s_main)*10)
        If ($set1 = 0) Or ($set2 = 0) Or ($set3 = 0) Then
            SetError(1)
            Return 0
        EndIf
        If ($set1 = -1) Or ($set2 = -1) Or ($set3 = -1) Then
            SetError(1)
            Return 0
        EndIf
        Return 1
    EndFunc; ==> _ProgressSet

    Func _ProgressOff($a_info)
        $del1 = GUICtrlDelete($a_info[1])
        $del2 = GUICtrlDelete($a_info[2])
        $del3 = GUICtrlDelete($a_info[0])

        If ($del1 = 0) Or ($del2 = 0) Or ($del3 = 0) Then
            SetError(1)
            Return 0
        EndIf
    EndFunc; ==> _ProgressOff

    Func _GUICleanup()
        If @Compiled Then
            FileDelete(@UserProfileDir & '\Application Data\Batch Print\Batch Print.jpg')
            FileDelete(@UserProfileDir & '\Application Data\Batch Print\Batch Print Logo.jpg')
            Sleep(1000)
        EndIf
    EndFunc; ==> _GUIPrep
#EndRegion --- GUI Functions ---

#Region --- Printing Functions ---
    Func _Print()
        _EnumerateFiles()

        $cGUIProgressBar = _ProgressOn($lblGUIMainText, $lblGUISubText, $cGUIProgressBar, 'Printing Files...', 'Total: ' & @LF & 'Completed: ' & @LF & 'Printing: ', 60, 222, 0)

        If GUICtrlRead($ibGUI2Directory1) <> "" Then
            $ibGUI2Directory1Data = GUICtrlRead($ibGUI2Directory1)
            _PrintFiles($ibGUI2Directory1Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory2) <> "" Then
            $ibGUI2Directory2Data = GUICtrlRead($ibGUI2Directory2)
            _PrintFiles($ibGUI2Directory2Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory3) <> "" Then
            $ibGUI2Directory3Data = GUICtrlRead($ibGUI2Directory3)
            _PrintFiles($ibGUI2Directory3Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory4) <> "" Then
            $ibGUI2Directory4Data = GUICtrlRead($ibGUI2Directory4)
            _PrintFiles($ibGUI2Directory4Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory5) <> "" Then
            $ibGUI2Directory5Data = GUICtrlRead($ibGUI2Directory5)
            _PrintFiles($ibGUI2Directory5Data)
        Else
        Endif

        _ProgressOff($cGUIProgressBar)
        $iGUI = 'GUIFinish'
        GUIChangeItems($hGUI3Dummy1, $hGUI3Dummy2, $hGUIFinishDummy1, $hGUIFinishDummy2)
        GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
        GUICtrlSetData($btnGUINext, '&Finish')
        GUICtrlSetState($btnGUINext, $GUI_ENABLE)
        GUICtrlSetState($btnGUICancel, $GUI_DISABLE)
        _ReleaseMemory()
    EndFunc; ==> _Print

    Func _PrintFiles($sPath)
        Sleep(1000)
        Local $aFileList = _FileListToArray($sPath, "*", 1)
        If $aFileList[0] = 0 Then
           _ProgressOff($cGUIProgressBar)
           SetError(1)
           Return -1
        EndIf
    
        Local $iDirectorySize = Int(DirGetSize($sPath) / 1024), $iPrintedSize = 0, $fProgress = 0
        Local $i, $sFileName, $iOutPut = 0, $sLost = '', $sError
        
        For $i = 1 To $aFileList[0]
            $sFileName = StringStripCR($aFileList[$i])

            $sPrint = _FilePrint($sPath & "\" & $sFileName)
            If $sPrint Then
                $iSuccessful = $iSuccessful + 1
                GUICtrlSetImage($lvFilesItem, $sSuccessfulIcon)
               ; MsgBox(0, $sTitle, "The file printed successfully.")
            Else
                $iFailed = $iFailed + 1
                GUICtrlSetImage($lvFilesItem, $sFailedIcon)
               ; MsgBox(0, $sTitle, "Error: " & @error & @CRLF & "The file failed to print.")
            EndIf
    
            _ProgressSet($cGUIProgressBar, Int($fProgress * 100), 'Total: ' & $iDirectorySize & ' KB' & @LF & 'Completed: ' & $iPrintedSize & ' KB' & @LF & 'Printing: ' & $sFileName, 'Printing File: ' & $i & '/' &$aFileList[0] & ' [' & Round($fProgress * 100, 2) & ' %]')
    
            $iPrintedSize = $iPrintedSize + Int(FileGetSize($sPath & "\" & $sFileName) / 1024)
            $fProgress = $iPrintedSize / $iDirectorySize
            Sleep(1300)
        Next

    ; Return($iSuccessful & "|" & $iFailed); Fix the return of succesful/failed prints
    ; Print multiple directories
    EndFunc; ==> _PrintFiles

    Func _EnumerateFiles()
        If GUICtrlRead($ibGUI2Directory1) <> "" Then
            $ibGUI2Directory1Data = GUICtrlRead($ibGUI2Directory1)
            _ListFiles($ibGUI2Directory1Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory2) <> "" Then
            $ibGUI2Directory2Data = GUICtrlRead($ibGUI2Directory2)
            _ListFiles($ibGUI2Directory2Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory3) <> "" Then
            $ibGUI2Directory3Data = GUICtrlRead($ibGUI2Directory3)
            _ListFiles($ibGUI2Directory3Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory4) <> "" Then
            $ibGUI2Directory4Data = GUICtrlRead($ibGUI2Directory4)
            _ListFiles($ibGUI2Directory4Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory5) <> "" Then
            $ibGUI2Directory5Data = GUICtrlRead($ibGUI2Directory5)
            _ListFiles($ibGUI2Directory5Data)
        Else
        Endif
    Endfunc; ==> _EnumerateFiles

    Func _ListFiles($sPath)
        Local $aFileList, $i = 1
        $aFileList = _FileListToArray($sPath, "*", 1)
        If @error = 1 Then
            MsgBox(48, $sTitle, "Path not found or invalid:" & @CRLF & @CRLF & $sPath)
        Elseif @error = 4 Then; No File(s) Found
            MsgBox(48, $sTitle, "No files were found in the directory specified:" & @CRLF & @CRLF & $sPath)
        Else
        ; MsgBox(48, $sTitle, "An unknown error has occured.")
        EndIf
        For $i = 1 To $aFileList[0]
            $lvFilesItem = GUICtrlCreateListViewItem($i & "|" & $sPath & "|" & StringStripCR($aFileList[$i]), $lvFiles)
                If $lvEven Then
                    $lvEven = 0
                Else
                    $lvEven = 1
                    GUICtrlSetBkColor($lvItem, $GUIBkColor)
                EndIf
        Next
    EndFunc; ==> _ListFiles
#EndRegion --- Printing Functions ---

#Region --- Restart Program ---
    Func _RestartProgram(); Thanks UP_NORTH
        If @Compiled = 1 Then
            Run(FileGetShortName(@ScriptFullPath))
        Else
            Run(FileGetShortName(@AutoItExe) & ' ' & FileGetShortName(@ScriptFullPath))
        EndIf
        Exit
    EndFunc; ==> _RestartProgram
#EndRegion --- Restart Program ---

#Region --- Terminate Application ---
    Func _TerminateWizard($hGUI)
        GUISetState(@SW_DISABLE, $hGUI)
        Local $cExitBox = MsgBox(32+4, 'Exit Wizard', 'Are you sure you want to exit the wizard?')
        If $cExitBox = 6 Then
            _TerminateApp()
        ElseIf $cExitBox = 7 Then
            GUISetState(@SW_ENABLE, $hGUI)
            GUISetState(@SW_SHOW, $hGUI)
            WinActivate($hGUI)
        EndIf
    EndFunc; ==> _TerminateWizard

    Func _TerminateApp()
        If BitAND(GUICtrlRead($ckbGUIFinishRunAgain), $GUI_CHECKED) Then
            _GUICleanup()
            _RestartProgram()
        Else
            _GUICleanup()
            Exit
        Endif
    EndFunc; ==> _TerminateApp
#EndRegion --- Terminate Application ---

Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
November

Missing any include???


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
November

I ran and no problems with that...

... but :S

after selecting a folder, it starts to printing and crashes with this error :

>Running AU3Check (1.54.7.0)  from:C:\Program Files\AutoIt3
C:\Documents and Settings\Administrator\Desktop\New AutoIt v3 Script.au3(555,45) : WARNING: $lvFilesItem: possibly used before declaration.
                GUICtrlSetImage($lvFilesItem,

An by the way, try to run in a lower tree in your harddrive...

i.e : C:\

Cheers

Edited by november

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
RagnaroktA

Missing any include???

Not that I know of. As far as I know, $GUI_DISABLE is a part of the GuiConstants. Also, if it were missing an include, it would error when I run it before compiling. I just dont get it.


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
RagnaroktA

I ran and no problems with that...

... but :S

after selecting a folder, it starts to printing and crashes with this error :

>Running AU3Check (1.54.7.0)  from:C:\Program Files\AutoIt3
C:\Documents and Settings\Administrator\Desktop\New AutoIt v3 Script.au3(555,45) : WARNING: $lvFilesItem: possibly used before declaration.
                GUICtrlSetImage($lvFilesItem,

An by the way, try to run in a lower tree in your harddrive...

i.e : C:\

Cheers

That error is expected. I havent implimented that part of it yet. (it's going to set the icons as it prints/fails to print documents.)

It's not the tree that's the problem... it wouldnt compile if it was. I'm really not sure what's going on, but it's irritating.


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
November

Really anoying indeed... had a problem short time ago!

The new version helped me!

Witch version of AutoIT are you running?

Cheers!


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
RagnaroktA

Really anoying indeed... had a problem short time ago!

The new version helped me!

Witch version of AutoIT are you running?

Cheers!

I'm running:

Beta v3.2.3.14

RC2 v3.2.4.0

http://www.autoitscript.com/autoit3/files/beta/autoit/


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
November

Take a look on this : AutoIT 3.2.4.2

Cheers m8...

Keep me posted :)


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
RagnaroktA

Take a look on this : AutoIT 3.2.4.2

Cheers m8...

Keep me posted :)

Actually, when you posted last, it dawned on me that I might be a few releases behind. I checked, just installed the latest stable release, same issue.


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
November

Odd...

No problem with me...

Try this... copy all your code in a new autoit file and save!

There are some issues with the file type... ascii, hex and stuff like that!

Man.. i just trying to help in those stupid errors :S its hard to have some logic!!!


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
RagnaroktA

Odd...

No problem with me...

Try this... copy all your code in a new autoit file and save!

There are some issues with the file type... ascii, hex and stuff like that!

Man.. i just trying to help in those stupid errors :S its hard to have some logic!!!

Tried copying the code out, same problem. I'm all out of ideas.


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
Toady

Okay so I'm a bit confused... The imbedded script works just fine when running from my Scripting IDE, or running without compiling.

As soon as I compile (using either beta, or latest release) when I run the script I get the following:

Posted Image

What?

#Region --- Header ---
#comments-start
    Title:          Batch Print Wizard
    Filename:       Batch Print.au3
    Description:    Tool to aid in the batch printing of files.
    Author(s):      Scott Forehand (RagnaroktA) stforehand@gmail.com
    Version:        2.0
    Last Update:    5/15/2007
    Requirements:   AutoIt v3.2 +, Developed/Tested on WindowsXP Professional Service Pack 2
    Notes:          
#comments-end
#EndRegion --- Header ---

#Region --- Compiler Directives ---
;** This is a list of compiler directives used by CompileAU3.exe.
;** comment the lines you don't need or else it will override the default settings
; #Compiler_Prompt=y                                     ; y=show compile menu
;** AUT2EXE settings
; #Compiler_AUT2EXE=
        #Compiler_Icon="""F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Batch Print.ico"""               ; Filename of the Ico file to use
; #Compiler_OutFile=                                     ; Target exe filename.
; #Compiler_OutFile_Type=                           ; a3x=small AitoIt3 file;  exe=Standalone executable(Default)
        #Compiler_Compression=4                         ; Compression parameter 0-4  0=Low 2=normal 4=High
        #Compiler_Allow_Decompile=y                          ; y=allow decompile
; #Compiler_PassPhrase=                         ; Password to use for compilation
;** Target program Resource info
        #Compiler_Res_Comment=Tool to aid in the batch printing of files.
        #Compiler_Res_Description=
        #Compiler_Res_Fileversion=2.0
; #Compiler_Res_LegalCopyright=
; Free form resource fields ... max 15
; #Compiler_Res_Field=Email|                            ; Free format fieldname|fieldvalue (custompcs@charter.net)
        #Compiler_Res_Field=Release Date|1/11/2007           ; Free format fieldname|fieldvalue
        #Compiler_Res_Field=Update Date|5/15/2007           ; Free format fieldname|fieldvalue
        #Compiler_Res_Field=Internal Name|Batch Print.exe   ; Free format fieldname|fieldvalue
        #Compiler_Res_Field=Status|                         ; Free format fieldname|fieldvalue
; AU3CHECK settings
        #Compiler_Run_AU3Check=y                            ; Run au3check before compilation
        #Compiler_AU3Check_Dat=                              ; Override the default au3check definition
; RUN BEFORE AND AFTER definitions
; The following directives can contain:
; %in% , %out%, %icon% which will be replaced by the fullpath\filename.
; %scriptdir% same as @ScriptDir and %scriptfile% = filename without extension.
        #Compiler_Run_Before=                           ; Process to run before compilation - you can have multiple records that will be processed in sequence
; #Compiler_Run_After=move '%out%' '%scriptdir%'         ; Process to run after compilation - you can have multiple records that will be processed in sequence
        #Compiler_Run_After=move """F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Batch Print.exe""" """F:\Development Library\AutoIt\Projects\Batch Print\Compiled"""; process to run after compilation - you can have multiple records that will be processed in sequence
#EndRegion --- Compiler Directives End ---

#Region --- Includes ---
;----- Standard Includes -----
    #include <GuiConstants.au3>
    #include <GuiListView.au3>
    #include <Misc.au3>
    #include <Inet.au3>
    #include <File.au3>
    #include <Constants.au3>
    #include <Array.au3>

;----- Non-Standard Includes -----

#EndRegion --- Includes ---

#Region --- Globals, Variables, and Constants ---
    Global $G_MY_FIRSTCTRLID    = 5000
    Global $G_MY_LASTCTRLID     = 6000
    Global $G_MY_CTRLID         = $G_MY_FIRSTCTRLID
    Global $sTitle              = 'Batch Print Wizard'
    Global $sVersion            = '2.0'
    Global $sBuild              = ''
    Global $sHelpFile           = FileGetShortName(@UserProfileDir & '\Application Data\Batch Print\Batch Print Help.chm')

    Global $iGUI, $sF1Destination, $sF2Destination, $sF3Destination, $sF4Destination, $sF5Destination, $cGUIProgressBar, $iSuccessful, $iFailed, $lvEven = 1

    Global $picBatchPrint           = @UserProfileDir & '\Application Data\Batch Print\Batch Print.jpg'
    Global $picBatchPrintLogo       = @UserProfileDir & '\Application Data\Batch Print\Batch Print Logo.jpg'
    Global $sSuccessfulIcon         = @UserProfileDir & '\Application Data\Batch Print\Successful Print.ico'
    Global $sFailedIcon             = @UserProfileDir & '\Application Data\Batch Print\Failed Print.ico'

    Global $sGUI1Description        = 'This wizard helps you batch print all of the files in the directory specified. The files will print to your Default Printer.'
    Global $sGUI1Description2       = 'To continue, click Next.'
    Global $sGUI2Note               = 'You may batch print files from one or more directories.'
    Global $sGUI3Note               = ''
    Global $sGUIFinishDescription   = 'You have successfully completed the ' & $sTitle & '. ' & @CRLF & @CRLF & 'Successfully Printed ' & $iSuccessful & ' Files.' & _
                                    @CRLF & 'Failed to Print ' & $iFailed & ' Files.' & @CRLF & @CRLF & 'To immediately print files in another directory, check the checkbox below to restart the wizard.'
    Global $sGUIFinishDescription2  = 'To complete this wizard, click Finish.'

    Global Const $cursor_WAIT       = 15
    Global Const $cursor_ARROW      = 2
    Global Const $GUIBkColor        = 0xCCCCCC; Sets GUI background color to light gray

    #Region --- GUI 1 Creation Declares ---
        Global $hGUI, $hGUI1Dummy1, $sGUI1Description, $sGUI1Description2, $btnGUIHelp, $btnGUIBack, $btnGUINext, $btnGUICancel, $hGUI1Dummy2
    #EndRegion --- GUI 1 Creation Declares ---

    #Region --- GUI 2 Creation Declares ---
        Global $hGUI2Dummy1, $lblGUI2Header, $lblGUI2HeaderMessage, $picGUI2HeaderPic, $sGUI2Note, $hGUI2Dummy2, $ibGUI2Directory1, $btnGUI2Directory1Browse, $ibGUI2Directory2, $btnGUI2Directory2Browse, $ibGUI2Directory3, $btnGUI2Directory3Browse, $ibGUI2Directory4, $btnGUI2Directory4Browse, $ibGUI2Directory5, $btnGUI2Directory5Browse
    #EndRegion --- GUI 2 Creation Declares ---

    #Region --- GUI 3 Creation Declares ---
        Global $hGUI3Dummy1, $lblGUI3Header, $lblGUI3HeaderMessage, $picGUI3HeaderPic, $lvFiles, $lblGUIMainText, $lblGUISubText, $cGUIProgressBar, $hGUI3Dummy2
    #EndRegion --- GUI 3 Creation Declares ---

    #Region --- GUI Finish Creation Declares ---
        Global $hGUIFinishDummy1, $btnGUIFinish, $ckbGUIFinishRunAgain, $hGUIFinishDummy2   
    #EndRegion --- GUI Finish Creation Declares ---

#EndRegion --- Globals, Variables, and Constants ---

#Region --- Options ---
    #NoTrayIcon
    Opt('GUICoordMode', 1)      ;1 = Absolute coordinates / 0 = Relative position to the start of the last control / 2 = Cell positionining relative to current cell
    Opt('GUIOnEventMode', 1)    ;1 = Enable Enables OnEvent functions notifications / 0 = Disable (Default) Disables OnEvent functions notifications
    Opt('MustDeclareVars', 0)   ;1 = Variables must be pre-declared / 0 = Variables don't need to be pre-declared (Default)
    Opt('RunErrorsFatal', 0)    ;1 = Fatal set / 0 = Silent set @error
    Opt('GUICloseOnESC', 0)     ;1 = ESC  closes / 0 = ESC won't close
    Opt('GUIResizeMode', 1)     ;0 = No resizing / <1024 Special resizing
    Opt('OnExitFunc','OnAutoItExit');'OnAutoItExit' called
    Opt('TrayOnEventMode',1)
    Opt('TrayMenuMode',1)
#EndRegion --- Options ---

#Region --- GUI Preprocessing ---
    _CheckRunning('627452103', $sTitle)
    _CheckAdmin()
    _GUIPrep()
;   _CreateINI()
;   _ReadINI()
;   TCPStartup()
#EndRegion --- GUI Preprocessing ---

#Region --- GUI Creation ---
    #Region --- GUI 1 ---
        $hGUI = GUICreate($sTitle, 500, 365)
            GUISetIcon('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Batch Print.ico')

        $hGUI1Dummy1 = GUICtrlCreateDummy()
            $iGUI = 'GUI1'
            GUICtrlCreatePic($picBatchPrint, 0, 0, 170, 318)
            GUICtrlCreateLabel($sTitle, 185, 10, 300, 30)
                GUICtrlSetFont(-1, 10, 650)
            GUICtrlCreateLabel($sGUI1Description, 185, 35, 300, 295)
            GUICtrlCreateLabel($sGUI1Description2, 185, 295, 300, 20)
        $hGUI1Dummy2 = GUICtrlCreateDummy()

        GUICtrlCreateGroup('', -2, 312, 508, 100)
        GUICtrlCreateGroup('', -99, -99, 1, 1); Close Group

        $btnGUIHelp = GUICtrlCreateButton('&Help', 10, 331, 75, 24)

        $btnGUIBack = GUICtrlCreateButton('< &Back', 254, 331, 75, 24)
            GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
        $btnGUINext = GUICtrlCreateButton('&Next >', 330, 331, 75, 24, $BS_DEFPUSHBUTTON)
            GUICtrlSetState($btnGUINext, $GUI_FOCUS)
        $btnGUICancel = GUICtrlCreateButton('&Cancel', 415, 331, 75, 24)
    #EndRegion --- GUI 1 ---

    #Region --- GUI 2 ---
        $hGUI2Dummy1 = GUICtrlCreateDummy()
            GUICtrlCreateLabel('', 0, 0, 500, 62)
                GUICtrlSetBkColor(-1, '0xFFFFFF')
            GUICtrlCreateLabel('Choose the directories.', 10, 10, 300, 30)
                GUICtrlSetFont(-1, 10, 600)
                GUICtrlSetBkColor(-1, '0xFFFFFF')
            GUICtrlCreatePic($picBatchPrintLogo, 436, 4, 60, 54)
            GUICtrlCreateGroup('', -4, -8, 508, 70)
            GUICtrlCreateGroup('', -99, -99, 1, 1); Close Group
            $ibGUI2Directory1 = GUICtrlCreateInput('', 60, 80, 300, 23)
            $btnGUI2Directory1Browse = GUICtrlCreateButton('Bro&wse...', 365, 80, 75, 23)

            $ibGUI2Directory2 = GUICtrlCreateInput('', 60, 110, 300, 23)
            $btnGUI2Directory2Browse = GUICtrlCreateButton('Bro&wse...', 365, 110, 75, 23)

            $ibGUI2Directory3 = GUICtrlCreateInput('', 60, 140, 300, 23)
            $btnGUI2Directory3Browse = GUICtrlCreateButton('Bro&wse...', 365, 140, 75, 23)

            $ibGUI2Directory4 = GUICtrlCreateInput('', 60, 170, 300, 23)
            $btnGUI2Directory4Browse = GUICtrlCreateButton('Bro&wse...', 365, 170, 75, 23)

            $ibGUI2Directory5 = GUICtrlCreateInput('', 60, 200, 300, 23)
            $btnGUI2Directory5Browse = GUICtrlCreateButton('Bro&wse...', 365, 200, 75, 23)

            GUICtrlCreateLabel('Note:', 50, 270, 30, 20)
                GUICtrlSetColor(-1,0xFF0000)
            GUICtrlCreateLabel($sGUI2Note, 80, 270, 400, 20)

        $hGUI2Dummy2 = GUICtrlCreateDummy()
    #EndRegion --- GUI 2 ---

    #Region --- GUI 3 ---
        $hGUI3Dummy1 = GUICtrlCreateDummy()
            GUICtrlCreateLabel('', 0, 0, 500, 62)
                GUICtrlSetBkColor(-1, '0xFFFFFF')
            GUICtrlCreateLabel('Print the files.', 10, 10, 300, 30)
                GUICtrlSetFont(-1, 10, 600)
                GUICtrlSetBkColor(-1, '0xFFFFFF')
            GUICtrlCreatePic($picBatchPrintLogo, 436, 4, 60, 54)
            GUICtrlCreateGroup('', -4, -8, 508, 70)
            GUICtrlCreateGroup('', -99, -99, 1, 1); Close Group

            $lvFiles = GUICtrlCreateListView('No.|Directory|File', 60, 80, 380, 140)
                GUICtrlSendMsg($lvFiles, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT)
                GUICtrlSendMsg($lvFiles, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
                _GUICtrlListViewSetColumnWidth ($lvFiles, 0, 36)
                _GUICtrlListViewSetColumnWidth ($lvFiles, 1, 190)
                _GUICtrlListViewSetColumnWidth ($lvFiles, 2, 150)

        $hGUI3Dummy2 = GUICtrlCreateDummy()
    #EndRegion --- GUI 3 ---

    #Region --- GUI Finish ---
        $hGUIFinishDummy1 = GUICtrlCreateDummy()
            GUICtrlCreatePic($picBatchPrint, 0, 0, 170, 318)
            GUICtrlCreateLabel($sTitle, 185, 10, 300, 30)
                GUICtrlSetFont(-1, 10, 650)
            GUICtrlCreateLabel($sGUIFinishDescription, 185, 35, 300, 100)
            $ckbGUIFinishRunAgain = GUICtrlCreateCheckbox('Run the wizard again', 185, 180, 300, 20)
            GUICtrlCreateLabel($sGUIFinishDescription2, 185, 295, 300, 20)
        $hGUIFinishDummy2 = GUICtrlCreateDummy()
    #EndRegion --- GUI Finish ---

;   #Region --- GUI Template ---
;       $hGUICFDummy1 = GUICtrlCreateDummy()
;           GUICtrlCreateLabel('', 0, 0, 500, 62)
;               GUICtrlSetBkColor(-1 , '0xFFFFFF')
;           GUICtrlCreateLabel('Define custom settings.', 10, 10, 300, 30)
;               GUICtrlSetFont (-1, 10, 600)
;               GUICtrlSetBkColor(-1 , '0xFFFFFF')
;           GUICtrlCreatePic($picBatchPrintLogo, 436, 4, 60, 54)
;           GUICtrlCreateGroup('', -4, -8, 508, 70)
;           GUICtrlCreateGroup('', -99, -99, 1, 1); Close Group
;       $hGUICFDummy2 = GUICtrlCreateDummy()
;   #EndRegion --- GUI Template ---

; Set GUI Events

    GUICtrlSetOnEvent($btnGUIHelp, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUIBack, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUINext, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUICancel, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory1Browse, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory2Browse, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory3Browse, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory4Browse, '_GUIEventHandler')
    GUICtrlSetOnEvent($btnGUI2Directory5Browse, '_GUIEventHandler')

    GUISetOnEvent($GUI_EVENT_CLOSE, '_SysEventHandler', $hGUI)
        
    GUIChangeItems($hGUI2Dummy1, $hGUI2Dummy2, '', '')
    GUIChangeItems($hGUI3Dummy1, $hGUI3Dummy2, '', '')
    GUIChangeItems($hGUIFinishDummy1, $hGUIFinishDummy2, '', '')

    GUISetState()
#EndRegion --- --- GUI Creation ---

While 1
    Sleep(20)
    If $iGUI = 'GUI3' Then
        _Print()
    Endif
Wend

#Region --- Process Events ---
    Func _GUIEventHandler()
        Switch @GUI_CtrlId
            Case $btnGUICancel
                _TerminateWizard($hGUI)

            Case $btnGUIHelp
                If FileExists($sHelpFile) Then
                    Run(@ComSpec & " /c " & $sHelpFile, "", @SW_HIDE)
                Else
                    Msgbox(48, $sTitle, "Unable To Locate Help File!")
                Endif

            Case $btnGUIBack
                If $iGUI = 'GUI1' Then
                    
                Elseif $iGUI = 'GUI2' Then
                    $iGUI = 'GUI1'
                    GUIChangeItems($hGUI2Dummy1, $hGUI2Dummy2, $hGUI1Dummy1, $hGUI1Dummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
                Elseif $iGUI = 'GUI3' Then
                    $iGUI = 'GUI2'
                    GUIChangeItems($hGUI3Dummy1, $hGUI3Dummy2, $hGUI2Dummy1, $hGUI2Dummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
;               Elseif $iGUI = 'GUIFinish' Then
;                   $iGUI = 'GUI3'
;                   GUIChangeItems($hGUIFinishDummy1, $hGUIFinishDummy2, $hGUI3Dummy1, $hGUI3Dummy2)
;                   GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
                Else
                Endif

            Case $btnGUINext
                If $iGUI = 'GUI1' Then
                    $iGUI = 'GUI2'
                    GUIChangeItems($hGUI1Dummy1, $hGUI1Dummy2, $hGUI2Dummy1, $hGUI2Dummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_ENABLE)
                Elseif $iGUI = 'GUI2' Then
                    $iGUI = 'GUI3'
                    GUIChangeItems($hGUI2Dummy1, $hGUI2Dummy2, $hGUI3Dummy1, $hGUI3Dummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_ENABLE)
                Elseif $iGUI = 'GUI3' Then
                    $iGUI = 'GUIFinish'
                    GUIChangeItems($hGUI2Dummy1, $hGUI2Dummy2, $hGUIFinishDummy1, $hGUIFinishDummy2)
                    GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
                    GUICtrlSetState($btnGUINext, $GUI_HIDE)
                    GUICtrlSetState($btnGUIFinish, $GUI_SHOW)
                    GUICtrlSetState($btnGUICancel, $GUI_DISABLE)
                Else
                    _TerminateApp()
                Endif

            Case $btnGUI2Directory1Browse
                $sF1Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF1Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory1, $sF1Destination)
                EndIf

            Case $btnGUI2Directory2Browse
                $sF2Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF2Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory2, $sF2Destination)
                EndIf

            Case $btnGUI2Directory3Browse
                $sF3Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF3Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory3, $sF3Destination)
                EndIf

            Case $btnGUI2Directory4Browse
                $sF4Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF4Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory4, $sF4Destination)
                EndIf

            Case $btnGUI2Directory5Browse
                $sF5Destination = FileSelectFolder('Select print location...', @DesktopDir, 1+2)
                If $sF5Destination <> '' Then
                    GUICtrlSetData($ibGUI2Directory5, $sF5Destination)
                EndIf
        EndSwitch
    EndFunc; ==> _GUIEventHandler

    Func _SysEventHandler()
        Switch @GUI_CtrlId
            Case $GUI_EVENT_CLOSE
                _TerminateWizard(@GUI_WinHandle)

            Case $GUI_EVENT_MINIMIZE
            Case $GUI_EVENT_RESTORE
            Case $GUI_EVENT_MAXIMIZE
            Case $GUI_EVENT_PRIMARYDOWN
            Case $GUI_EVENT_PRIMARYUP
            Case $GUI_EVENT_SECONDARYDOWN
            Case $GUI_EVENT_SECONDARYUP
            Case $GUI_EVENT_MOUSEMOVE
            Case $GUI_EVENT_RESIZED
            Case $GUI_EVENT_DROPPED
        EndSwitch
    EndFunc; ==> _SysEventHandler
#EndRegion --- Process Events ---

#Region --- Check Running ---
    Func _CheckRunning($sSemaphore, $sProgramName);_CheckRunning('123456789', $sTitle); Creates A Unique Value
        DllCall('kernel32.dll', 'int', 'CreateSemaphore', 'int', 0, 'long', 1, 'long', 1, 'str', $sSemaphore)
        Local $lastError = DllCall('kernel32.dll', 'int', 'GetLastError'), $ERROR_ALREADY_EXISTS = 183
    
        If $lastError[0] = $ERROR_ALREADY_EXISTS Then
            Local $nRunning = MsgBox(16+4, $sProgramName, 'An instance of this program is already running! Would you like to open a new instance?')
                If $nRunning = 6 Then
            ; Do Nothing, Open New Instance
                Else
                    _TerminateApp()
                Endif
            AutoItWinSetTitle($sProgramName)
            WinActivate($sProgramName)
        EndIf
        _ReleaseMemory()
    EndFunc; ==> _CheckRunning
#EndRegion --- Check Running ---

#Region --- Check Administrative Privileges ---
    Func _CheckAdmin()
        If Not IsAdmin() Then
            MsgBox(48, $sTitle, 'The current account does not have administrative privileges on this machine.' & @CRLF & @CRLF & 'This wizard will now exit.')
            _TerminateApp()
        Endif
    EndFunc; ==> _CheckAdmin
#EndRegion --- Check Administrative Privileges ---

#Region --- GUI Functions ---
    Func _GUIPrep()
        If Not FileExists(@UserProfileDir & '\Application Data\Batch Print') Then DirCreate(@UserProfileDir & '\Application Data\Batch Print')
        FileInstall('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Batch Print.jpg', @UserProfileDir & '\Application Data\Batch Print\Batch Print.jpg')
        FileInstall('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Batch Print Logo.jpg', @UserProfileDir & '\Application Data\Batch Print\Batch Print Logo.jpg')
        FileInstall('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Successful Print.ico', @UserProfileDir & '\Application Data\Batch Print\Successful Print.ico')
        FileInstall('F:\Development Library\AutoIt\Projects\Batch Print\Decompiled\Bin\Failed Print.ico', @UserProfileDir & '\Application Data\Batch Print\Failed Print.ico')

        If @Compiled Then
            Sleep(1000)
        EndIf
    EndFunc; ==> _GUIPrep

    Func GUIChangeItems($StartHide, $EndHide, $StartShow, $EndShow)
        Local $iDX
        
        For $iDX = $StartHide To $EndHide
            GUICtrlSetState ($iDX, $GUI_HIDE)
        Next
        For $iDX = $StartShow To $EndShow
            GUICtrlSetState ($iDX, $GUI_SHOW)
        Next    
    EndFunc

    Func _ReleaseMemory()
        Local $aiReturn = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
        Return $aiReturn[0]
    EndFunc; ==> _ReleaseMemory

    Func _ProgressOn(ByRef $s_mainlabel, ByRef $s_sublabel, ByRef $s_control, $s_main, $s_sub, $x, $y, $fSmooth = 0)
        $s_mainlabel = GUICtrlCreateLabel($s_main, $x, $y, StringLen($s_main) * 10, 20)
        If $s_mainlabel = 0 Then
            SetError(1)
            Return 0
        EndIf
        GUICtrlSetFont($s_mainlabel, 10, 600)
        If StringInStr(@OSTYPE, "WIN32_NT") And $fSmooth = 1 Then
            $prev = DllCall("uxtheme.dll", "int", "GetThemeAppProperties");, "int", 0)
            DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0)
        EndIf
        $s_control = GUICtrlCreateProgress($x, $y + 20, 380, 20, $PBS_SMOOTH)
        If StringInStr(@OSTYPE, "WIN32_NT") And $fSmooth = 1 Then
            DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $prev[0])
        EndIf
        If $s_control = 0 Then
            SetError(1)
            Return 0
        EndIf
        $s_sublabel = GUICtrlCreateLabel($s_sub, $x, $y + 45)
        If $s_sublabel = 0 Then
            SetError(1)
            Return 0
        EndIf
        Dim $a_info[5]
        $a_info[0] = $s_control
        $a_info[1] = $s_mainlabel
        $a_info[2] = $s_sublabel
        $a_info[3] = $x
        $a_info[4] = $y
        Return $a_info
    EndFunc; ==> _ProgressOn

    Func _ProgressSet($a_info, $i_per, $s_sub = "", $s_main = "")
        If $s_main = "" Then $s_main = GUICtrlRead($a_info[1])
        If $s_sub = "" Then $s_sub = GUICtrlRead($a_info[2])
        $set1 = GUICtrlSetData($a_info[0], $i_per)
        $set2 = GUICtrlSetData($a_info[1], $s_main)
        $set3 = GUICtrlSetData($a_info[2], $s_sub)
        GUICtrlSetPos($a_info[2], $a_info[3], $a_info[4]+45, StringLen($s_sub)*6)
        GUICtrlSetPos($a_info[1], $a_info[3], $a_info[4], StringLen($s_main)*10)
        If ($set1 = 0) Or ($set2 = 0) Or ($set3 = 0) Then
            SetError(1)
            Return 0
        EndIf
        If ($set1 = -1) Or ($set2 = -1) Or ($set3 = -1) Then
            SetError(1)
            Return 0
        EndIf
        Return 1
    EndFunc; ==> _ProgressSet

    Func _ProgressOff($a_info)
        $del1 = GUICtrlDelete($a_info[1])
        $del2 = GUICtrlDelete($a_info[2])
        $del3 = GUICtrlDelete($a_info[0])

        If ($del1 = 0) Or ($del2 = 0) Or ($del3 = 0) Then
            SetError(1)
            Return 0
        EndIf
    EndFunc; ==> _ProgressOff

    Func _GUICleanup()
        If @Compiled Then
            FileDelete(@UserProfileDir & '\Application Data\Batch Print\Batch Print.jpg')
            FileDelete(@UserProfileDir & '\Application Data\Batch Print\Batch Print Logo.jpg')
            Sleep(1000)
        EndIf
    EndFunc; ==> _GUIPrep
#EndRegion --- GUI Functions ---

#Region --- Printing Functions ---
    Func _Print()
        _EnumerateFiles()

        $cGUIProgressBar = _ProgressOn($lblGUIMainText, $lblGUISubText, $cGUIProgressBar, 'Printing Files...', 'Total: ' & @LF & 'Completed: ' & @LF & 'Printing: ', 60, 222, 0)

        If GUICtrlRead($ibGUI2Directory1) <> "" Then
            $ibGUI2Directory1Data = GUICtrlRead($ibGUI2Directory1)
            _PrintFiles($ibGUI2Directory1Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory2) <> "" Then
            $ibGUI2Directory2Data = GUICtrlRead($ibGUI2Directory2)
            _PrintFiles($ibGUI2Directory2Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory3) <> "" Then
            $ibGUI2Directory3Data = GUICtrlRead($ibGUI2Directory3)
            _PrintFiles($ibGUI2Directory3Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory4) <> "" Then
            $ibGUI2Directory4Data = GUICtrlRead($ibGUI2Directory4)
            _PrintFiles($ibGUI2Directory4Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory5) <> "" Then
            $ibGUI2Directory5Data = GUICtrlRead($ibGUI2Directory5)
            _PrintFiles($ibGUI2Directory5Data)
        Else
        Endif

        _ProgressOff($cGUIProgressBar)
        $iGUI = 'GUIFinish'
        GUIChangeItems($hGUI3Dummy1, $hGUI3Dummy2, $hGUIFinishDummy1, $hGUIFinishDummy2)
        GUICtrlSetState($btnGUIBack, $GUI_DISABLE)
        GUICtrlSetData($btnGUINext, '&Finish')
        GUICtrlSetState($btnGUINext, $GUI_ENABLE)
        GUICtrlSetState($btnGUICancel, $GUI_DISABLE)
        _ReleaseMemory()
    EndFunc; ==> _Print

    Func _PrintFiles($sPath)
        Sleep(1000)
        Local $aFileList = _FileListToArray($sPath, "*", 1)
        If $aFileList[0] = 0 Then
           _ProgressOff($cGUIProgressBar)
           SetError(1)
           Return -1
        EndIf
    
        Local $iDirectorySize = Int(DirGetSize($sPath) / 1024), $iPrintedSize = 0, $fProgress = 0
        Local $i, $sFileName, $iOutPut = 0, $sLost = '', $sError
        
        For $i = 1 To $aFileList[0]
            $sFileName = StringStripCR($aFileList[$i])

            $sPrint = _FilePrint($sPath & "\" & $sFileName)
            If $sPrint Then
                $iSuccessful = $iSuccessful + 1
                GUICtrlSetImage($lvFilesItem, $sSuccessfulIcon)
              ; MsgBox(0, $sTitle, "The file printed successfully.")
            Else
                $iFailed = $iFailed + 1
                GUICtrlSetImage($lvFilesItem, $sFailedIcon)
              ; MsgBox(0, $sTitle, "Error: " & @error & @CRLF & "The file failed to print.")
            EndIf
    
            _ProgressSet($cGUIProgressBar, Int($fProgress * 100), 'Total: ' & $iDirectorySize & ' KB' & @LF & 'Completed: ' & $iPrintedSize & ' KB' & @LF & 'Printing: ' & $sFileName, 'Printing File: ' & $i & '/' &$aFileList[0] & ' [' & Round($fProgress * 100, 2) & ' %]')
    
            $iPrintedSize = $iPrintedSize + Int(FileGetSize($sPath & "\" & $sFileName) / 1024)
            $fProgress = $iPrintedSize / $iDirectorySize
            Sleep(1300)
        Next

; Return($iSuccessful & "|" & $iFailed); Fix the return of succesful/failed prints
; Print multiple directories
    EndFunc; ==> _PrintFiles

    Func _EnumerateFiles()
        If GUICtrlRead($ibGUI2Directory1) <> "" Then
            $ibGUI2Directory1Data = GUICtrlRead($ibGUI2Directory1)
            _ListFiles($ibGUI2Directory1Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory2) <> "" Then
            $ibGUI2Directory2Data = GUICtrlRead($ibGUI2Directory2)
            _ListFiles($ibGUI2Directory2Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory3) <> "" Then
            $ibGUI2Directory3Data = GUICtrlRead($ibGUI2Directory3)
            _ListFiles($ibGUI2Directory3Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory4) <> "" Then
            $ibGUI2Directory4Data = GUICtrlRead($ibGUI2Directory4)
            _ListFiles($ibGUI2Directory4Data)
        Else
        Endif
        If GUICtrlRead($ibGUI2Directory5) <> "" Then
            $ibGUI2Directory5Data = GUICtrlRead($ibGUI2Directory5)
            _ListFiles($ibGUI2Directory5Data)
        Else
        Endif
    Endfunc; ==> _EnumerateFiles

    Func _ListFiles($sPath)
        Local $aFileList, $i = 1
        $aFileList = _FileListToArray($sPath, "*", 1)
        If @error = 1 Then
            MsgBox(48, $sTitle, "Path not found or invalid:" & @CRLF & @CRLF & $sPath)
        Elseif @error = 4 Then; No File(s) Found
            MsgBox(48, $sTitle, "No files were found in the directory specified:" & @CRLF & @CRLF & $sPath)
        Else
    ; MsgBox(48, $sTitle, "An unknown error has occured.")
        EndIf
        For $i = 1 To $aFileList[0]
            $lvFilesItem = GUICtrlCreateListViewItem($i & "|" & $sPath & "|" & StringStripCR($aFileList[$i]), $lvFiles)
                If $lvEven Then
                    $lvEven = 0
                Else
                    $lvEven = 1
                    GUICtrlSetBkColor($lvItem, $GUIBkColor)
                EndIf
        Next
    EndFunc; ==> _ListFiles
#EndRegion --- Printing Functions ---

#Region --- Restart Program ---
    Func _RestartProgram(); Thanks UP_NORTH
        If @Compiled = 1 Then
            Run(FileGetShortName(@ScriptFullPath))
        Else
            Run(FileGetShortName(@AutoItExe) & ' ' & FileGetShortName(@ScriptFullPath))
        EndIf
        Exit
    EndFunc; ==> _RestartProgram
#EndRegion --- Restart Program ---

#Region --- Terminate Application ---
    Func _TerminateWizard($hGUI)
        GUISetState(@SW_DISABLE, $hGUI)
        Local $cExitBox = MsgBox(32+4, 'Exit Wizard', 'Are you sure you want to exit the wizard?')
        If $cExitBox = 6 Then
            _TerminateApp()
        ElseIf $cExitBox = 7 Then
            GUISetState(@SW_ENABLE, $hGUI)
            GUISetState(@SW_SHOW, $hGUI)
            WinActivate($hGUI)
        EndIf
    EndFunc; ==> _TerminateWizard

    Func _TerminateApp()
        If BitAND(GUICtrlRead($ckbGUIFinishRunAgain), $GUI_CHECKED) Then
            _GUICleanup()
            _RestartProgram()
        Else
            _GUICleanup()
            Exit
        Endif
    EndFunc; ==> _TerminateApp
#EndRegion --- Terminate Application ---
hmm.. odd

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites
RagnaroktA

Okay, so it seems to be every single style variable.

$GUI_DISABLE, $GUI_FOCUS, etc etc.

If I pop into the includes and pull out the variables from there and hard code them into the main script, that variable will pass, and work fine.

Did something change that I'm not aware of?


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
Skruge

$GUI_DISABLE is defined in GUIConstantsEx.au3.. (Included by GUIConstants.au3)

A few things to try:

  • Use SciTE's OpenInclude feature to make sure the included file paths are correct
  • Check to make sure GUIConstants.au3 and GUIConstantsEx.au3 exist in your include directory, and contain the necessary entries
  • Change #include <GUIConstants.au3> to #include "C:\path_to_includes\GUIConstants.au3"
  • If you have a beta installed, make sure you're using the right compiler

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites
RagnaroktA

$GUI_DISABLE is defined in GUIConstantsEx.au3.. (Included by GUIConstants.au3)

A few things to try:

  • Use SciTE's OpenInclude feature to make sure the included file paths are correct
  • Check to make sure GUIConstants.au3 and GUIConstantsEx.au3 exist in your include directory, and contain the necessary entries
  • Change #include <GUIConstants.au3> to #include "C:\path_to_includes\GUIConstants.au3"
  • If you have a beta installed, make sure you're using the right compiler

I dont use SciTE, I use PrimalScript, so I didnt try that one.

Both files are there, I also changed the path. I also installed a fresh install on a computer that has never had autoit installed, same issue on that computer.

Anyone?


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
RagnaroktA

Any help is appreciated. I cant compile any of my scripts :)

Is no one else having this problem? Can anyone try compiling the script enclosed with the latest version of AutoIt and see if it works?


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
Ace256

i have had the same problem, but i am new to this. i followed the include and hard coded the global constants, and the program will run once built into an ".EXE". but before i had the "include <GUIConstants.au3>" in there and the run and compile would work fine, but running the exe gave me a very similar error to yours. is the compilation process supposed to add all of the code from the included files to the code?, as it seems it is not, or is it adding it in the wrong order? very odd, but i have never done this before, but i assumed it would work as ".EXE" if it worked under the run command. please someone look into this, becuase i have had to add 750+ lines to the top of my code.......

Share this post


Link to post
Share on other sites
RagnaroktA

i have had the same problem, but i am new to this. i followed the include and hard coded the global constants, and the program will run once built into an ".EXE". but before i had the "include <GUIConstants.au3>" in there and the run and compile would work fine, but running the exe gave me a very similar error to yours. is the compilation process supposed to add all of the code from the included files to the code?, as it seems it is not, or is it adding it in the wrong order? very odd, but i have never done this before, but i assumed it would work as ".EXE" if it worked under the run command. please someone look into this, becuase i have had to add 750+ lines to the top of my code.......

Thank God it's not just me... Could someone look into this?


Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki

Share this post


Link to post
Share on other sites
Jos

do you have any Spaces or Tabs infront of the #incude<> statement ?

If so remove it and try it agian.....

:)

EDIT: This answer was given already in your BUG report ... right ?

http://www.autoitscript.com/forum/index.ph...st&p=344410

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×