Sign in to follow this  
Followers 0
Fran

button doesn't want to show

10 posts in this topic

Hi,

Busy with a script (only half done, that's why all the comments)

Problem is... When I hit the $butBack button, the $but1 button is supposed to reappear, but it doesn't. This is really strange. I can't see any reason why it should stay hidden.

Any ideas?

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=images\App_ISO.ico
#AutoIt3Wrapper_Outfile=CreateInstallationFiles_Multi.exe
#AutoIt3Wrapper_Res_Fileversion=10.10.4.6
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#cs -------------------------------------------------------------------------------------------

    AutoIt Version:   3.3.6.1
    Author:           Francisca Carstens

    Script Function:
    Create .iso image files for RapidStudio software Installation
    -   Update variables (labcodes and purls) in various files:
    AlbumMaker.ini, LabConfig.ini, User.ini, orderExplanationScreen.htm,
    createExplanationScreen.htm
    -   Create Pre-Install screen
    Check for internet and ftp access
    Check for previous installation of AlbumMaker and prompts user to backup album files
    -   Apply latest patch after installation to update a few files
    Order SDK, FTP Time-Out in FTPCore, delete thumbs.db and clear readonly attributes
    on all files in the installation directory as well as album directories

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

#Region -> Includes
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <Array.au3>
#include <file.au3>
#include <GUIComboBox.au3>
#include <Process.au3>
#include <_LargeFileCopy.au3>
#include <EditConstants.au3>
#include <GuiTab.au3>
#include <Word.au3>
#include <String.au3>
#include <IE.au3>
#include <GUIListBox.au3>
#include <FTPEx.au3>
#EndRegion -> Includes

#Region -> Options
Opt("TrayAutoPause", 0)
Opt("TrayIconHide", 0)
Opt('MustDeclareVars', 0)
#EndRegion -> Options

#Region -> Declarations
Global $configDir = @ScriptDir & "\config\", $imageDIR = @ScriptDir & "\images\", $webDIR = "http://www.rapidstudio.info/fran"
Global $server = 'ftp.rapidstudio.co.za', $username = 'support', $pass = 'support'
Global $issub, $progressbar
Global $blue = 0x99ccff
Global $version = IniRead(@ScriptDir & "\config\CreateCDConfig.ini", "", "LAST_VERSION", "")
Local $sItems
Local $y = 860, $z = 600, $g = 15 ;y:gui width, g:margin, z:gui height
Local $b = $g, $c = $y - ($g * 2) ;b:left position of main box; c:width of main box
Local $l = $b + $g, $w = $c - ($g * 2) ;l:left position of cat boxes; $w:width of cat boxes
Local $p = 90, $q = 30, $pS = 50, $qS = 20 ;p:button width, q:buttn height, pS:small button width, qS: small button height
Local $d = $z - $q - ($g * 3) ;d:height of main box
Local $n = $y - $g - $p, $o = $z - $g - $q, $r = $n - $g - $p ;n:button left, o:button top, r:button2 left
Local $tL = $l + $g, $tT = $g + 45, $tW = 100 ;tL:textlabels left, $tT: 1st textlabel top, $tW:textlabels width
Local $font = "Courier New"
#EndRegion -> Declarations

#Region -> GUI Items
$gui = GUICreate("Create ISO image", $y, $z + 30, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_EX_TOPMOST))
GUISetFont(0, 400, 0)
$box1 = GUICtrlCreateGroup("Select setup details", $b, $tT, $c, (450) + ($g * 5))
#Region -> ListBox Affiliates
Global $hListBox = GUICtrlCreateList("", $tL, $tT + 30, 300, $z - $tT - 65, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL, $WS_VSCROLL, $LBS_SORT))
GUICtrlSetState(-1, $GUI_DISABLE)
#EndRegion -> ListBox Affiliates
#Region -> ComboBox VERSION
;~ $labelVERSION = GUICtrlCreateLabel("Version", $tL, $tT + (30 * 2) + 400, $tW, 20)
GUICtrlSetState(-1, $GUI_DISABLE)
Global $hComboVERSION = GUICtrlCreateCombo("", $tL + 300 + $g, $tT + 30, 200, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL))
GUICtrlSetState(-1, $GUI_DISABLE)
$aFileListVer = _FileListToArray("..\.\", "*.*.*F", 2)
If @error Then
    MsgBox(0, "Error", "No files/directories matched the search pattern for VERSION LIST")
    Exit
EndIf
$sFileListVer = _ArrayToString($aFileListVer, "|", 1)
$sFileListVer = StringReplace($sFileListVer, "_CF", "")
$sFileListVer = StringReplace($sFileListVer, "_DF", "")
$aFileListVer = StringSplit($sFileListVer, "|")
$aNewArray = _ArrayUnique($aFileListVer, 1, 1)
$sFileListVer = _ArrayToString($aNewArray, "|", 1)
GUICtrlSetData($hComboVERSION, $sFileListVer, $version)
#EndRegion -> ComboBox VERSION

$but1 = GUICtrlCreateButton("Go >>", $y - 150, $tT + 30, 100, 50)
GUICtrlSetState(-1, $GUI_DISABLE)


$label1 = GUICtrlCreateLabel("", $tL, $z - 180, ($tW * 6), 20)
GUICtrlSetState(-1, $GUI_HIDE)
$label2 = GUICtrlCreateLabel("", $tL, $z - 180 + 20, ($tW * 3), 20)
GUICtrlSetState(-1, $GUI_HIDE)
$label3 = GUICtrlCreateLabel("", $tL, $z - 180 + 40, ($tW * 3), 20)
GUICtrlSetState(-1, $GUI_HIDE)
$label4 = GUICtrlCreateLabel("", $tL, $z - 180 + 60, ($tW * 3), 20)
GUICtrlSetState(-1, $GUI_HIDE)
$label5 = GUICtrlCreateLabel("", $tL, $z - 180 + 80, ($tW * 3), 20)
GUICtrlSetState(-1, $GUI_HIDE)


$butCompile = GUICtrlCreateButton("Compile", $y - 130, $z - 35, 100, 50)
GUICtrlSetState(-1, $GUI_HIDE)

$butBack = GUICtrlCreateButton("Back", $y - 245, $z - 35, 100, 50)
GUICtrlSetState(-1, $GUI_HIDE)
#EndRegion -> GUI Items


_Main()
Func _Main()
    GUISetState()
    $labelDownloading = GUICtrlCreateLabel("Downloading affiliate list from http://www.rapidstudio.info/fran", ($y - 770) / 2, $g, 770, 40, $SS_CENTER)
    GUICtrlSetFont(-1, 20)
    GUICtrlSetColor(-1, 0x0000FF)
    _RunDOS("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8")

    $oIE = _IECreate("http://www.rapidstudio.info/fran/getaffiliatelist.php", 0, 0, 1)
    Sleep(2000)
    _IEQuit($oIE)
    $Open = _FTP_Open('MyFTP Control')
    $Conn = _FTP_Connect($Open, $server, $username, $pass)
    _FTP_FileGet($Conn, "fran\listaff.txt", @TempDir & "\listaff.txt")
    $Ftpc = _FTP_Close($Open)
    $aFile = @TempDir & "\listaff.txt"
    GUICtrlSetState($labelDownloading, $GUI_HIDE)
    $labelHeading = GUICtrlCreateLabel("Choose an affiliate and version number and hit 'GO'.", "", $g, $y, 40, $SS_CENTER)
    GUICtrlSetFont(-1, 20)
;~  GUICtrlSetBkColor(-1, 0x000000)
;~  GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetState($hListBox, BitOR($GUI_ENABLE, $GUI_FOCUS))
    GUICtrlSetState($hComboVERSION, $GUI_ENABLE)
    GUICtrlSetState($but1, BitOR($GUI_ENABLE, $BS_DEFPUSHBUTTON))
    Dim $aRecords
    _FileReadToArray($aFile, $aRecords)
    $aRecords = _ArrayUnique($aRecords)
    $str = _ArrayToString($aRecords, "|", 1)
    GUICtrlSetData($hListBox, $str)



    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
;~              If MsgBox(8196, "Cancel", "Are you sure you want to cancel this operation?") = 6 Then Exit
                FileDelete(@TempDir & "\*labcodes.txt")
                FileDelete(@TempDir & "\listaff.txt")
                FileDelete(@TempDir & "\link.txt")
                Exit

            Case $but1
                GUICtrlSetState($labelHeading, $GUI_HIDE)
                GUICtrlSetState($box1, $GUI_HIDE)
                $version = GUICtrlRead($hComboVERSION)
                $versionCD = GUICtrlRead($hComboVERSION) & "_CF"
                $versionDL = GUICtrlRead($hComboVERSION) & "_DF"
                $aItemsCount = _GUICtrlListBox_GetSelCount($hListBox)
                $aItems = _GUICtrlListBox_GetSelItemsText($hListBox)
                For $iI = 1 To $aItems[0]
                    $sItems &= @LF & $aItems[$iI]
                Next
;~              MsgBox(0, "result", "Items Selected: (" & $aItemsCount & ")" & $sItems & @CRLF)
;~              If $aItemsCount > 1 Then
;~                  MsgBox(0, "Error", "This setup only allows for one item to be selected. Please try again.")
                If $aItemsCount = 0 Then
                    MsgBox(0, "Error", "Please select at least one affiliate.")
                Else
                    GUICtrlSetState($hListBox, $GUI_HIDE)
                    GUICtrlSetState($hComboVERSION, $GUI_HIDE)
                    GUICtrlSetState($but1, $GUI_HIDE)
                    GUICtrlSetData($box1, "Creating image files")
                    GUICtrlSetData($labelDownloading, "Downloading affiliate details from http://www.rapidstudio.info/fran")
                    GUICtrlSetState($labelDownloading, $GUI_SHOW)


                    $tab = GUICtrlCreateTab(30, $tT, 800, 500, $TCS_FIXEDWIDTH)

                    $iMax = $aItemsCount
                    Global $labcode[$iMax], $companyname[$iMax], $afftype[$iMax], $sitename[$iMax], $afftype[$iMax], $issub[$iMax], $sublabcode[$iMax], $maincompany[$iMax]
                    Global $labelcompanyname[$iMax], $labellabcode[$iMax], $labelpurl[$iMax], $labelmain[$iMax], $labelmainlabcode[$iMax], $labelDLOutput[$iMax], $labelCDOutput[$iMax]
                    Dim $tabItem[$iMax]
                    Global $inputcompanyname[$iMax], $inputtype[$iMax], $inputlabcode[$iMax], $inputpurl[$iMax], $issub[$iMax], $inputmain[$iMax], $inputmainlabcode[$iMax], $inputDLOutput[$iMax], $inputCDOutput[$iMax]
                    Global $outputDLbasicEXE[$iMax], $outputDLstdEXE[$iMax], $outputDLbasicZIP[$iMax], $outputDLstdZIP[$iMax], $outputISO[$iMax]
                    For $i = 0 To $iMax - 1
                        $aArray = StringSplit($aItems[$i + 1], ",")
;~                  $aArray = StringSplit(GUICtrlRead($hListBox), ",")
                        $labcode[$i] = StringStripWS($aArray[2], 3)

                        $oIE = _IECreate("http://www.rapidstudio.info/fran/getaffiliateinfo.php?labcode=" & $labcode[$i], 0, 0, 1)
                        Sleep(2000)
                        _IEQuit($oIE)
                        $Open = _FTP_Open('MyFTP Control')
                        $Conn = _FTP_Connect($Open, $server, $username, $pass)
                        _FTP_FileGet($Conn, "fran\affinfo.txt", @TempDir & "\affinfo.txt")
                        $Ftpc = _FTP_Close($Open)
                        $aFile = @TempDir & "\affinfo.txt"
                        GUICtrlSetState($labelDownloading, $GUI_HIDE)
                        GUICtrlSetData($labelHeading, "Check the affiliate details and hit 'Compile'.")
                        GUICtrlSetState($labelHeading, $GUI_SHOW)
                        $str = FileReadLine($aFile, 1)
                        $aArray = StringSplit($str, ",")
                        If $aArray = "" Then
                            MsgBox(0, "Error", "Oops! This affiliate does not exist.")

                        Else
                            $companyname[$i] = StringStripWS($aArray[1], 3)
                            $labcode[$i] = StringStripWS($aArray[4], 3)
                            $afftype[$i] = StringStripWS($aArray[3], 3)
                            $sitename[$i] = StringStripWS($aArray[2], 3)
                            If $afftype[$i] = "subaffiliate" Then
                                $issub[$i] = 1
                            Else
                                $issub[$i] = 0
                            EndIf


                            If $issub[$i] = 1 Then
                                $sublabcode[$i] = $labcode[$i]
                                $oIE = _IECreate("http://www.rapidstudio.info/fran/linkaffiliates.php?labcode=" & $labcode[$i], 0, 0, 1)
                                Sleep(2000)
                                _IEQuit($oIE)
                                $Open = _FTP_Open('MyFTP Control')
                                $Conn = _FTP_Connect($Open, $server, $username, $pass)
                                _FTP_FileGet($Conn, "fran\link.txt", @TempDir & "\link.txt")
                                $Ftpc = _FTP_Close($Open)
                                $aFile = @TempDir & "\link.txt"
                                $str = FileReadLine($aFile, 2)
                                $aArray = StringSplit($str, ",")
                                $maincompany[$i] = StringStripWS($aArray[2], 3)
                                $labcode[$i] = StringStripWS($aArray[1], 3)
;~                          MsgBox(0, "Result", $companyname & @CR & $sublabcode & @CR & $afftype & @CR & $sitename & @CR & $maincompany & @CR & $labcode)
                            Else
                                $sublabcode[$i] = ""
                            EndIf
;~                          MsgBox(0, "", $companyname[$i] & @CR & $labcode[$i] & @CR & $sitename[$i] & @CR & $afftype[$i] & @CR & $sublabcode[$i] & @CR & $maincompany[$i])

                            $tabItem[$i] = GUICtrlCreateTabItem($companyname[$i])

                            $labelcompanyname[$i] = GUICtrlCreateLabel("Affiliate Name", $tL, $tT + ($g * 6) + 3, $tW, 30)
                            $inputcompanyname[$i] = GUICtrlCreateInput($companyname[$i], $tL + $tW + $g, $tT + ($g * 6), ($tW * 4), 30, $ES_READONLY)
                            $inputtype[$i] = GUICtrlCreateInput($afftype[$i], $tL + $tW + ($g * 2) + ($tW * 4), $tT + + ($g * 6), ($tW * 2), 30, $ES_READONLY)
                            $labellabcode[$i] = GUICtrlCreateLabel("Lab Code", $tL, $tT + (30 * 1) + ($g * 7) + 3, $tW, 30)


                            If $issub = 1 Then
                                $inputlabcode[$i] = GUICtrlCreateInput($sublabcode[$i], $tL + $tW + $g, $tT + (30 * 1) + ($g * 7), $tW, 30, $ES_READONLY)
                                GUICtrlSetFont(-1, 0, 600, 0, $font, 5)
                            Else
                                $inputlabcode[$i] = GUICtrlCreateInput($labcode[$i], $tL + $tW + $g, $tT + (30 * 1) + ($g * 7), $tW, 30, $ES_READONLY)
                                GUICtrlSetFont(-1, 0, 600, 0, $font, 5)
                            EndIf

                            $labelpurl[$i] = GUICtrlCreateLabel("PURL", $tL + ($tW * 2) + ($g * 4), $tT + (30 * 1) + ($g * 7) + 3, 50, 30, $SS_RIGHT)
                            $inputpurl[$i] = GUICtrlCreateInput($sitename[$i], $tL + ($g * 2) + ($tW * 3), $tT + (30 * 1) + ($g * 7), ($tW * 4), 30, $ES_READONLY)
                            $issub[$i] = 1
                            If $issub[$i] = 1 Then
                                $labelmain[$i] = GUICtrlCreateLabel("Main Affiliate", $tL, $tT + (30 * 2) + ($g * 8) + 3, $tW, 30)
                                $inputmain[$i] = GUICtrlCreateInput($maincompany[$i], $tL + $tW + $g, $tT + (30 * 2) + ($g * 8), ($tW * 3), 30, $ES_READONLY)
                                $labelmainlabcode[$i] = GUICtrlCreateLabel("Software Lab Code", $tL + ($tW * 3.5) + ($g * 7), $tT + (30 * 2) + ($g * 8) + 3, ($tW * 1.5), 30, $SS_RIGHT)
                                $inputmainlabcode[$i] = GUICtrlCreateInput($labcode[$i], $tL + ($g * 2) + ($tW * 6), $tT + (30 * 2) + ($g * 8), $tW, 30, $ES_READONLY)
                                GUICtrlSetFont(-1, 0, 600, 0, $font, 5)
                            EndIf

                            If $issub[$i] = 1 Then
                                $outputDLbasicEXE[$i] = $versionDL & "basic" & "_" & $labcode[$i] & "_" & $sublabcode[$i] & ".exe"
                                $outputDLstdEXE[$i] = $versionDL & "std" & "_" & $labcode[$i] & "_" & $sublabcode[$i] & ".exe"
                                $outputDLbasicZIP[$i] = $versionDL & "basic" & "_" & $labcode[$i] & "_" & $sublabcode[$i] & ".zip"
                                $outputDLstdZIP[$i] = $versionDL & "std" & "_" & $labcode[$i] & "_" & $sublabcode[$i] & ".zip"
                                $outputISO[$i] = $sublabcode[$i] & "_" & $labcode[$i] & "_" & $versionCD & ".iso"
                            ElseIf $issub[$i] = 0 Then
                                $outputDLbasicEXE[$i] = $versionDL & "basic" & "_" & $labcode[$i] & ".exe"
                                $outputDLstdEXE[$i] = $versionDL & "std" & "_" & $labcode[$i] & ".exe"
                                $outputDLbasicZIP[$i] = $versionDL & "basic" & "_" & $labcode[$i] & ".zip"
                                $outputDLstdZIP[$i] = $versionDL & "std" & "_" & $labcode[$i] & ".zip"
                                $outputISO[$i] = $labcode[$i] & "_" & $versionCD & ".iso"
                            EndIf

                            $labelDLOutput[$i] = GUICtrlCreateLabel("Output EXE's", $tL, $tT + (30 * 3) + ($g * 9) + 3, $tW, 30)
                            $inputDLOutput[$i] = GUICtrlCreateEdit($outputDLbasicEXE[$i] & @CRLF & $outputDLstdEXE[$i], $tL + $tW + $g, $tT + (30 * 3) + ($g * 9), ($tW * 6) + $g, 60, BitOR($ES_READONLY, $ES_MULTILINE))
                            GUICtrlSetFont(-1, 0, 600, 0, $font, 5)
                            GUICtrlSetColor(-1, 0x0000FF)
                            $labelCDOutput[$i] = GUICtrlCreateLabel("Output ISO", $tL, $tT + (30 * 3) + ($g * 10) + 3 + 60, $tW, 30)
                            $inputCDOutput[$i] = GUICtrlCreateEdit($outputISO[$i], $tL + $tW + $g, $tT + (30 * 3) + ($g * 10) + 60, ($tW * 4) + $g, 30, BitOR($ES_READONLY, $ES_MULTILINE))
                            GUICtrlSetFont(-1, 0, 600, 0, $font, 5)
                            GUICtrlSetColor(-1, 0x0000FF)
                            GUICtrlCreateTabItem("")
                        EndIf
                    Next
                    GUICtrlSetState($butCompile, $GUI_SHOW)
                    GUICtrlSetState($butBack, $GUI_SHOW)
                EndIf

            Case $butCompile
                #cs;=====================================================================================================================================================
                    GUICtrlSetData($box1, "")
                    GUICtrlSetState($labelcompanyname, $GUI_DISABLE)
                    GUICtrlSetState($inputcompanyname, $GUI_DISABLE)
                    GUICtrlSetState($inputtype, $GUI_DISABLE)
                    GUICtrlSetState($labellabcode, $GUI_DISABLE)
                    GUICtrlSetState($inputlabcode, $GUI_DISABLE)
                    GUICtrlSetState($labelpurl, $GUI_DISABLE)
                    GUICtrlSetState($inputpurl, $GUI_DISABLE)
                    If $issub = 1 Then
                    GUICtrlSetState($labelmain, $GUI_DISABLE)
                    GUICtrlSetState($inputmain, $GUI_DISABLE)
                    GUICtrlSetState($labelmainlabcode, $GUI_DISABLE)
                    GUICtrlSetState($inputmainlabcode, $GUI_DISABLE)
                    EndIf
                    GUICtrlSetState($labelDLOutput, $GUI_DISABLE)
                    GUICtrlSetState($inputDLOutput, $GUI_DISABLE)
                    GUICtrlSetState($labelCDOutput, $GUI_DISABLE)
                    GUICtrlSetState($inputCDOutput, $GUI_DISABLE)

                    GUICtrlSetState($butCompile, $GUI_DISABLE)
                    GUICtrlSetState($butBack, $GUI_DISABLE)

                    ; Start the progress bar
                    $progressbar = GUICtrlCreateProgress(($y - 600) / 2, $z - 60, 600, 30, $PBS_MARQUEE)
                    _SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 20) ; final parameter is update time in ms

                    GUICtrlSetData($label1, "Copying files...")
                    GUICtrlSetState($label1, $GUI_SHOW)

                    #Region Copying Directories
                    FileChangeDir(@ScriptDir)
                    FileChangeDir("..\.")
                    GUICtrlSetData($label1, "Copying directory 1 of 6: fscommand_basic")
                    Local $filecopy_src = @WorkingDir & "\" & $versionDL & "\_originalfiles\fscommand_basic"
                    Local $filecopy_destpath = @ScriptDir & "\_tmp\fscommand_basic"
                    _CopyDirWithProgress($filecopy_src, $filecopy_destpath)
                    GUICtrlSetData($label1, "Copying directory 2 of 6: fscommand_basic (extra files)")
                    Local $filecopy_src = @WorkingDir & "\" & $versionDL & "\_originalfiles\extra files"
                    Local $filecopy_destpath = @ScriptDir & "\_tmp\fscommand_basic"
                    _CopyDirWithProgress($filecopy_src, $filecopy_destpath)
                    FileCopy(@WorkingDir & "\" & $versionDL & "\_originalfiles\RapidStudio_install.exe", @ScriptDir & "\_tmp\RapidStudio_install.exe")
                    FileCopy(@WorkingDir & "\" & $versionDL & "\_originalfiles\App.ico", @ScriptDir & "\_tmp\App.ico")
                    GUICtrlSetData($label1, "Copying directory 3 of 6: fscommand_std")
                    Local $filecopy_src = @WorkingDir & "\" & $versionDL & "\_originalfiles\fscommand_std"
                    Local $filecopy_destpath = @ScriptDir & "\_tmp\fscommand_std"
                    _CopyDirWithProgress($filecopy_src, $filecopy_destpath)
                    GUICtrlSetData($label1, "Copying directory 4 of 6: fscommand_std (extra files)")
                    Local $filecopy_src = @WorkingDir & "\" & $versionDL & "\_originalfiles\extra files"
                    Local $filecopy_destpath = @ScriptDir & "\_tmp\fscommand_std"
                    _CopyDirWithProgress($filecopy_src, $filecopy_destpath)

                    GUICtrlSetData($label1, "Copying directory 5 of 6: fscommand_cd")
                    Local $filecopy_src = @WorkingDir & "\" & $versionCD & "\fscommand"
                    Local $filecopy_destpath = @ScriptDir & "\_tmp\fscommand_cd"
                    _CopyDirWithProgress($filecopy_src, $filecopy_destpath)
                    GUICtrlSetData($label1, "Copying directory 6 of 6: fscommand_cd (extra files)")
                    Local $filecopy_src = @WorkingDir & "\" & $versionCD & "\extra files"
                    Local $filecopy_destpath = @ScriptDir & "\_tmp\fscommand_cd"
                    _CopyDirWithProgress($filecopy_src, $filecopy_destpath)
                    GUICtrlSetData($label1, "Copying files... done")
                    #EndRegion Copying Directories


                    #Region Updating variables
                    GUICtrlSetData($label2, "Updating variables...")
                    GUICtrlSetState($label2, $GUI_SHOW)
                    $albINIbasic = @ScriptDir & "\_tmp\fscommand_basic\MPR500 Pro 5\AlbumMaker.ini"
                    $albINIstd = @ScriptDir & "\_tmp\fscommand_std\MPR500 Pro 5\AlbumMaker.ini"
                    $albINIcd = @ScriptDir & "\_tmp\fscommand_cd\MPR500 Pro 5\AlbumMaker.ini"
                    $userINIbasic = @ScriptDir & "\_tmp\fscommand_basic\MPR500 Pro 5\User.ini"
                    $userINIstd = @ScriptDir & "\_tmp\fscommand_std\MPR500 Pro 5\User.ini"
                    $userINIcd = @ScriptDir & "\_tmp\fscommand_cd\MPR500 Pro 5\User.ini"
                    $labINIbasic = @ScriptDir & "\_tmp\fscommand_basic\MPR500 Pro 5\LabConfig.ini"
                    $labINIstd = @ScriptDir & "\_tmp\fscommand_std\MPR500 Pro 5\LabConfig.ini"
                    $labINIcd = @ScriptDir & "\_tmp\fscommand_cd\MPR500 Pro 5\LabConfig.ini"
                    $crHTMbasic = @ScriptDir & "\_tmp\fscommand_basic\Lang\English\createExplanationScreen.htm"
                    $orHTMbasic = @ScriptDir & "\_tmp\fscommand_basic\Lang\English\orderExplanationScreen.htm"
                    $crHTMstd = @ScriptDir & "\_tmp\fscommand_std\Lang\English\createExplanationScreen.htm"
                    $orHTMstd = @ScriptDir & "\_tmp\fscommand_std\Lang\English\orderExplanationScreen.htm"
                    $crHTMcd = @ScriptDir & "\_tmp\fscommand_cd\Lang\English\createExplanationScreen.htm"
                    $orHTMcd = @ScriptDir & "\_tmp\fscommand_cd\Lang\English\orderExplanationScreen.htm"
                    $infoTXTbasic = @ScriptDir & "\_tmp\fscommand_basic\info.txt"
                    $infoTXTstd = @ScriptDir & "\_tmp\fscommand_std\info.txt"
                    $infoTXTcd = @ScriptDir & "\_tmp\fscommand_cd\info.txt"
                    _UpdateAlbumMakerINI($albINIbasic, $issub, $sublabcode, $sitename)
                    _UpdateAlbumMakerINI($albINIstd, $issub, $sublabcode, $sitename)
                    _UpdateAlbumMakerINI($albINIcd, $issub, $sublabcode, $sitename)
                    _UpdateUserINI($userINIbasic, $labcode)
                    _UpdateUserINI($userINIstd, $labcode)
                    _UpdateUserINI($userINIcd, $labcode)
                    _UpdateLabConfigINI($labINIbasic, $sitename)
                    _UpdateLabConfigINI($labINIstd, $sitename)
                    _UpdateLabConfigINI($labINIcd, $sitename)
                    _UpdateHTM("www.rapidstudio.co.za", "www." & $sitename & ".rapidstudio.co.za", $crHTMbasic, $orHTMbasic, $crHTMstd, $orHTMstd, $crHTMcd, $orHTMcd)
                    _UpdateInfoTXT($infoTXTbasic, $infoTXTstd, $infoTXTcd, $sitename)
                    #EndRegion Updating variables
                    ;~              #cs;---------------------------------------------------------------------------------------------------------
                    #Region Create basic self extractor
                    GUICtrlSetData($label3, "Creating Basic zip file...")
                    GUICtrlSetState($label3, $GUI_SHOW)
                    DirMove(@ScriptDir & "\_tmp\fscommand_basic", @ScriptDir & "\_tmp\fscommand")
                    $zipBasic = @ScriptDir & "\_tmp\RapidStudio_" & $outputDLbasicZIP
                    $exeBasic = "RapidStudio_" & $outputDLbasicEXE
                    FileChangeDir(@ScriptDir)
                    FileChangeDir("..\.")
                    $command1 = """" & @ProgramFilesDir & "\Winzip\" & "wzzip"" -x""" & @ScriptDir & "\_tmp\fscommand_*\*.*"" -p -r """ & "" & $zipBasic & """ " & """" & @ScriptDir & "\_tmp"""
                    $command2 = """" & @ProgramFilesDir & "\WinZip Self-Extractor\" & "wzipse32"" """ & $zipBasic & """ -setup -runasadmin -auto -le -st""RapidStudio""" & " -mokcancel " & """" & @ScriptDir & "\config\RS.dl.dialog_OKcancel.txt""" & " -t " & """" & @ScriptDir & "\config\RS.dl.dialog_extract.txt""" & " -i " & """" & @ScriptDir & "\images\App.ico""" & " -c """ & "RapidStudio_install.exe"""
                    $batch = @ScriptDir & "\winzip.bat"
                    $file = FileOpen($batch, 2)
                    FileWrite($file, $command1 & @CRLF & $command2)
                    FileClose($file)
                    RunWait($batch, @ScriptDir, @SW_HIDE)
                    Sleep(2000)
                    FileDelete($batch)
                    FileChangeDir(@ScriptDir)
                    FileChangeDir("..\.")
                    FileMove(@ScriptDir & "\_tmp\" & $exeBasic, @WorkingDir & "\RS_Software_Downloads\" & $exeBasic)
                    FileDelete($zipBasic)
                    DirMove(@ScriptDir & "\_tmp\fscommand", @ScriptDir & "\_tmp\fscommand_basic")
                    #EndRegion Create basic self extractor

                    #Region Create standard self extractor
                    GUICtrlSetData($label4, "Creating Standard zip file...")
                    GUICtrlSetState($label4, $GUI_SHOW)
                    DirMove(@ScriptDir & "\_tmp\fscommand_std", @ScriptDir & "\_tmp\fscommand")
                    $zipStd = @ScriptDir & "\_tmp\RapidStudio_" & $outputDLstdZIP
                    $exeStd = "RapidStudio_" & $outputDLstdEXE
                    FileChangeDir(@ScriptDir)
                    FileChangeDir("..\.")
                    $command1 = """" & @ProgramFilesDir & "\Winzip\" & "wzzip"" -x""" & @ScriptDir & "\_tmp\fscommand_*\*.*"" -p -r """ & "" & $zipStd & """ " & """" & @ScriptDir & "\_tmp"""
                    $command2 = """" & @ProgramFilesDir & "\WinZip Self-Extractor\" & "wzipse32"" """ & $zipStd & """ -setup -runasadmin -auto -le -st""RapidStudio""" & " -mokcancel " & """" & @ScriptDir & "\config\RS.dl.dialog_OKcancel.txt""" & " -t " & """" & @ScriptDir & "\config\RS.dl.dialog_extract.txt""" & " -i " & """" & @ScriptDir & "\images\App.ico""" & " -c """ & "RapidStudio_install.exe"""
                    $batch = @ScriptDir & "\winzip.bat"
                    $file = FileOpen($batch, 2)
                    FileWrite($file, $command1 & @CRLF & $command2)
                    FileClose($file)
                    RunWait($batch, @ScriptDir, @SW_HIDE)
                    Sleep(2000)
                    FileDelete($batch)
                    FileChangeDir(@ScriptDir)
                    FileChangeDir("..\.")
                    FileMove(@ScriptDir & "\_tmp\" & $exeStd, @WorkingDir & "\RS_Software_Downloads\" & $exeStd)
                    FileDelete($zipStd)
                    DirMove(@ScriptDir & "\_tmp\fscommand", @ScriptDir & "\_tmp\fscommand_std")
                    #EndRegion Create standard self extractor
                    ;~              #ce;---------------------------------------------------------------------------------------------------------

                    DirRemove(@ScriptDir & "\_tmp\fscommand_std", 1)
                    DirRemove(@ScriptDir & "\_tmp\fscommand_basic", 1)
                    FileMove(@ScriptDir & "\_tmp\Rapidstudio_install.exe", @ScriptDir & "\_tmp\Rapidstudio_" & $version & ".exe")
                    $file = FileOpen(@ScriptDir & "\_tmp\Autorun.inf", 2)
                    FileWrite($file, "[autorun]" & @CRLF & "open=Rapidstudio_" & $version & @CRLF & "icon=App.ico")
                    FileClose($file)

                    GUICtrlSetData($label5, "Creating ISO file...")
                    GUICtrlSetState($label5, $GUI_SHOW)
                    DirMove(@ScriptDir & "\_tmp\fscommand_cd", @ScriptDir & "\_tmp\fscommand")
                    FileChangeDir(@ScriptDir)
                    FileChangeDir("..\.")
                    If $issub = 1 Then
                    $command = """" & @ProgramFilesDir & "\Windows AIK\Tools\x86\" & "oscdimg"" -n -d -o -l " & $sublabcode & " """ & @ScriptDir & "\_tmp"" """ & @WorkingDir & "\RS_Software_ISO\" & $outputISO & """ |""" & @ScriptDir & "\ConsolRead.exe"""
                    Else
                    $command = """" & @ProgramFilesDir & "\Windows AIK\Tools\x86\" & "oscdimg"" -n -d -o -l " & $labcode & " """ & @ScriptDir & "\_tmp"" """ & @WorkingDir & "\RS_Software_ISO\" & $outputISO & """ |" & @ScriptDir & "\ConsolRead.exe"""
                    EndIf
                    $batch = @ScriptDir & "\iso.bat"
                    $file = FileOpen($batch, 2)
                    FileWrite($file, $command)
                    FileClose($file)
                    ;~              MsgBox(0, "Result", "ISO batch file compiled.") ;for testing
                    RunWait($batch, @ScriptDir, @SW_HIDE)
                    Sleep(2000)
                    FileDelete($batch)

                    IniWrite(@ScriptDir & "\config\CreateCDConfig.ini", "", "LAST_VERSION", $version)

                    While 1
                    If FileExists(@WorkingDir & "\RS_Software_ISO\" & $outputISO) = False Then
                    ;~                      MsgBox(0, "Error", "ISO failed.  Trying again...")
                    FileChangeDir(@ScriptDir)
                    FileChangeDir("..\.")
                    If $issub = 1 Then
                    $command = """" & @ProgramFilesDir & "\Windows AIK\Tools\x86\" & "oscdimg"" -n -d -o """ & @ScriptDir & "\_tmp"" """ & @WorkingDir & "\RS_Software_ISO\" & $outputISO & """ |""" & @ScriptDir & "\ConsolRead.exe"""
                    Else
                    $command = """" & @ProgramFilesDir & "\Windows AIK\Tools\x86\" & "oscdimg"" -n -d -o """ & @ScriptDir & "\_tmp"" """ & @WorkingDir & "\RS_Software_ISO\" & $outputISO & """ |""" & @ScriptDir & "\ConsolRead.exe"""
                    EndIf
                    $batch = @ScriptDir & "\iso.bat"
                    $file = FileOpen($batch, 2)
                    FileWrite($file, $command)
                    FileClose($file)
                    ;~              MsgBox(0, "Result", "ISO batch file compiled.") ;for testing
                    RunWait($batch, @ScriptDir, @SW_HIDE)
                    Sleep(2000)
                    FileDelete($batch)
                    EndIf
                    If FileExists(@WorkingDir & "\RS_Software_ISO\" & $outputISO) = True Then ExitLoop
                    WEnd

                    DirRemove(@ScriptDir & "\_tmp", 1)

                    ;~              MsgBox(0, "", "Finished!!") ;for testing
                    GUICtrlSetState($butBack, $GUI_ENABLE)
                    ;~              _GUICtrlButton_Click($butBack)
                    ShellExecute(@WorkingDir & "\RS_Software_ISO\", "", "", "", @SW_MAXIMIZE)
                    Exit

                #ce;=====================================================================================================================================================

            Case $butBack
                GUICtrlSetData($labelHeading, "Choose an affiliate and version number and hit 'GO'.")
                GUICtrlDelete($tab)
                For $i = 0 To $iMax - 1
                    GUICtrlDelete($tabItem[$i])
                    GUICtrlDelete($labcode[$i])
                    GUICtrlDelete($companyname[$i])
                    GUICtrlDelete($afftype[$i])
                    GUICtrlDelete($sitename[$i])
                    GUICtrlDelete($issub[$i])
                    GUICtrlDelete($sublabcode[$i])
                    GUICtrlDelete($maincompany[$i])
                    GUICtrlDelete($labelcompanyname[$i])
                    GUICtrlDelete($labellabcode[$i])
                    GUICtrlDelete($labelpurl[$i])
                    GUICtrlDelete($labelmain[$i])
                    GUICtrlDelete($labelmainlabcode[$i])
                    GUICtrlDelete($labelDLOutput[$i])
                    GUICtrlDelete($inputcompanyname[$i])
                    GUICtrlDelete($inputtype[$i])
                    GUICtrlDelete($inputlabcode[$i])
                    GUICtrlDelete($inputpurl[$i])
                    GUICtrlDelete($inputmain[$i])
                    GUICtrlDelete($inputmainlabcode[$i])
                    GUICtrlDelete($inputDLOutput[$i])
                    GUICtrlDelete($inputCDOutput[$i])
                    GUICtrlDelete($outputDLbasicEXE[$i])
                    GUICtrlDelete($outputDLstdEXE[$i])
                    GUICtrlDelete($outputDLbasicZIP[$i])
                    GUICtrlDelete($outputDLstdZIP[$i])
                    GUICtrlDelete($outputISO[$i])
                Next

                GUICtrlSetState($butBack, $GUI_HIDE)
                GUICtrlSetState($butCompile, $GUI_HIDE)
                GUICtrlSetState($hListBox, $GUI_SHOW)
                GUICtrlSetState($hComboVERSION, $GUI_SHOW)
                GUICtrlSetData($box1, "Setup Details")
                GUICtrlSetState($box1, $GUI_SHOW)
                GUICtrlSetState($hComboVERSION, $GUI_SHOW)
                GUICtrlSetState($but1, $GUI_SHOW)
        EndSwitch

    WEnd
EndFunc   ;==>_Main

#Region -> Functions
Func _UpdateAlbumMakerINI($ini, $issub, $sublabcode, $sitename)
    Dim $iniLine1 = FileReadLine($ini, 1)
    if ($iniLine1 = "[]") = False Then MsgBox(0, "Error", "Error with AlbumMaker.ini.  Check that the first line = [] and then start this again." & @CRLF & $ini)
    Dim $file = FileOpen($ini, 32)
    If $issub = 1 Then
        IniWrite($ini, "", "FTP_PAY_URL", " http://www.rapidstudio.co.za/payment/order_v6-0-1-4.php?id={0}&subcode=" & $sublabcode)
        IniWrite($ini, "", "FTP_CD_URL", " http://www.rapidstudio.co.za/payment/order_v6-0-1-4.php?id={0}&subcode=" & $sublabcode)
    ElseIf $issub = 0 Then
        IniWrite($ini, "", "FTP_PAY_URL", " http://www.rapidstudio.co.za/payment/order_v6-0-1-4.php?id={0}&subcode=")
        IniWrite($ini, "", "FTP_CD_URL", " http://www.rapidstudio.co.za/payment/order_v6-0-1-4.php?id={0}&subcode=")
    EndIf
    IniWrite($ini, "", "WELCOME_URL", " www." & $sitename & ".rapidstudio.co.za")
    IniWrite($ini, "", "DEMO_URL", " http://" & $sitename & ".rapidstudio.co.za/za/?p=7720b5096823381bbc034684eacae463")
    IniWrite($ini, "", "PRICES_URL", " http://" & $sitename & ".rapidstudio.co.za/za/?p=e1e5878f4145b3af1cbb7e6408d989b3")
    IniWrite($ini, "", "CONTENT_URL", " http://" & $sitename & ".rapidstudio.co.za/za/?p=01269a47a6ff675cfa0afd01291b84e3")
    FileSetPos($file, 0, $FILE_BEGIN)
    FileClose($file)
    FileFlush($file)
EndFunc   ;==>_UpdateAlbumMakerINI

Func _UpdateUserINI($ini, $labcode)
    Dim $iniLine1 = FileReadLine($ini, 1)
    if ($iniLine1 = "[]") = False Then MsgBox(0, "Error", "Error with User.ini.  Check that the first line = [] and then start this again." & @CRLF & $ini)
    Dim $file = FileOpen($ini, 32)
    IniWrite($ini, "", "CUSTOMER_NUMBER", " " & $labcode)
    FileSetPos($file, 0, $FILE_BEGIN)
    FileClose($file)
    FileFlush($file)
EndFunc   ;==>_UpdateUserINI

Func _UpdateLabConfigINI($ini, $sitename)
    $file = FileOpen($ini, 32)
    IniWrite($ini, "PHOTO_LAB", "WEB", " www." & $sitename & ".rapidstudio.co.za")
    FileSetPos($file, 0, $FILE_BEGIN)
    FileClose($file)
    FileFlush($file)
EndFunc   ;==>_UpdateLabConfigINI

Func _UpdateHTM($find, $replace, $filename1, $filename2, $filename3, $filename4, $filename5, $filename6)
    $retval = _ReplaceStringInFile($filename1, $find, $replace)
    $retval = _ReplaceStringInFile($filename2, $find, $replace)
    $retval = _ReplaceStringInFile($filename3, $find, $replace)
    $retval = _ReplaceStringInFile($filename4, $find, $replace)
    $retval = _ReplaceStringInFile($filename5, $find, $replace)
    $retval = _ReplaceStringInFile($filename6, $find, $replace)
EndFunc   ;==>_UpdateHTM
Func _UpdateInfoTXT($txt1, $txt2, $txt3, $sitename)
    Dim $file = FileOpen($txt1, 2)
    FileWrite($file, "&purl=http://www." & $sitename & ".rapidstudio.co.za&")
    FileClose($file)
    Dim $file = FileOpen($txt2, 2)
    FileWrite($file, "&purl=http://www." & $sitename & ".rapidstudio.co.za&")
    FileClose($file)
    Dim $file = FileOpen($txt3, 2)
    FileWrite($file, "&purl=http://www." & $sitename & ".rapidstudio.co.za&")
    FileClose($file)
EndFunc   ;==>_UpdateInfoTXT

Func _CopyDirWithProgress($sOriginalDir, $sDestDir)
    ;$sOriginalDir and $sDestDir are quite selfexplanatory...
    ;This func returns:
    ; -1 in case of critical error, bad original or destination dir
    ; 0 if everything went all right
    ; >0 is the number of file not copied and it makes a log file
    ; if in the log appear as error message '0 file copied' it is a bug of some windows' copy command that does not redirect output...

    If StringRight($sOriginalDir, 1) <> '\' Then $sOriginalDir = $sOriginalDir & '\'
    If StringRight($sDestDir, 1) <> '\' Then $sDestDir = $sDestDir & '\'
    If $sOriginalDir = $sDestDir Then Return -1

    ProgressOn('Copying Files...', 'Making list of Files...' & @LF & @LF, '', -1, -1, 16)
    Local $aFileList = _FileSearch($sOriginalDir)
    If $aFileList[0] = 0 Then
        ProgressOff()
        SetError(1)
        Return -1
    EndIf

    If FileExists($sDestDir) Then
        If Not StringInStr(FileGetAttrib($sDestDir), 'd') Then
            ProgressOff()
            SetError(2)
            Return -1
        EndIf
    Else
        DirCreate($sDestDir)
        If Not FileExists($sDestDir) Then
            ProgressOff()
            SetError(2)
            Return -1
        EndIf
    EndIf

    Local $iDirSize, $iCopiedSize = 0, $fProgress = 0
    Local $c, $FileName, $iOutPut = 0, $sLost = '', $sError
    Local $Sl = StringLen($sOriginalDir)

    _Quick_Sort($aFileList, 1, $aFileList[0])

    $iDirSize = Int(DirGetSize($sOriginalDir) / 1024)

    ProgressSet(Int($fProgress * 100), $aFileList[$c], 'Copying file:')
    For $c = 1 To $aFileList[0]
        $FileName = StringTrimLeft($aFileList[$c], $Sl)
        ProgressSet(Int($fProgress * 100), $aFileList[$c] & ' -> ' & $sDestDir & $FileName & @LF & 'Total KB: ' & $iDirSize & @LF & 'Done KB: ' & $iCopiedSize, Round($fProgress * 100, 2) & ' % ' & $c & '/' & $aFileList[0])

        If StringInStr(FileGetAttrib($aFileList[$c]), 'd') Then
            DirCreate($sDestDir & $FileName)
        Else
            If Not FileCopy($aFileList[$c], $sDestDir & $FileName, 1) Then
                If Not FileCopy($aFileList[$c], $sDestDir & $FileName, 1) Then;Tries a second time
                    If RunWait(@ComSpec & ' /c copy /y "' & $aFileList[$c] & '" "' & $sDestDir & $FileName & '">' & @TempDir & '\o.tmp', '', @SW_HIDE) = 1 Then;and a third time, but this time it takes the error message
                        $sError = FileReadLine(@TempDir & '\o.tmp', 1)
                        $iOutPut = $iOutPut + 1
                        $sLost = $sLost & $aFileList[$c] & ' ' & $sError & @CRLF
                    EndIf
                    FileDelete(@TempDir & '\o.tmp')
                EndIf
            EndIf

;~ FileSetAttrib($sDestDir & $FileName, "+A-RSH");<- Comment this line if you do not want attribs reset.

            $iCopiedSize = $iCopiedSize + Int(FileGetSize($aFileList[$c]) / 1024)
            $fProgress = $iCopiedSize / $iDirSize
        EndIf
    Next

    ProgressOff()

    If $sLost <> '' Then;tries to write the log somewhere.
        If FileWrite($sDestDir & 'notcopied.txt', $sLost) = 0 Then
            If FileWrite($sOriginalDir & 'notcopied.txt', $sLost) = 0 Then
                FileWrite(@WorkingDir & '\notcopied.txt', $sLost)
            EndIf
        EndIf
    EndIf

    Return $iOutPut
EndFunc   ;==>_CopyDirWithProgress

Func _FileSearch($sIstr, $bSF = 1)
    ; $bSF = 1 means looking in subfolders
    ; $sSF = 0 means looking only in the current folder.
    ; An array is returned with the full path of all files found. The pos [0] keeps the number of elements.
    Local $sCriteria, $sBuffer, $iH, $iH2, $sCS, $sCF, $sCF2, $sCP, $sFP, $sOutPut = '', $aNull[1]
    $sCP = StringLeft($sIstr, StringInStr($sIstr, '\', 0, -1))
    If $sCP = '' Then $sCP = @WorkingDir & '\'
    $sCriteria = StringTrimLeft($sIstr, StringInStr($sIstr, '\', 0, -1))
    If $sCriteria = '' Then $sCriteria = '*.*'

    ;To begin we seek in the starting path.
    $sCS = FileFindFirstFile($sCP & $sCriteria)
    If $sCS <> -1 Then
        Do
            $sCF = FileFindNextFile($sCS)
            If @error Then
                FileClose($sCS)
                ExitLoop
            EndIf
            If $sCF = '.' Or $sCF = '..' Then ContinueLoop
            $sOutPut = $sOutPut & $sCP & $sCF & @LF
        Until 0
    EndIf

    ;And after, if needed, in the rest of the folders.
    If $bSF = 1 Then
        $sBuffer = @CR & $sCP & '*' & @LF;The buffer is set for keeping the given path plus a *.
        Do
            $sCS = StringTrimLeft(StringLeft($sBuffer, StringInStr($sBuffer, @LF, 0, 1) - 1), 1);current search.
            $sCP = StringLeft($sCS, StringInStr($sCS, '\', 0, -1));Current search path.
            $iH = FileFindFirstFile($sCS)
            If $iH <> -1 Then
                Do
                    $sCF = FileFindNextFile($iH)
                    If @error Then
                        FileClose($iH)
                        ExitLoop
                    EndIf
                    If $sCF = '.' Or $sCF = '..' Then ContinueLoop
                    If StringInStr(FileGetAttrib($sCP & $sCF), 'd') Then
                        $sBuffer = @CR & $sCP & $sCF & '\*' & @LF & $sBuffer;Every folder found is added in the begin of buffer
                        $sFP = $sCP & $sCF & '\'; for future searches
                        $iH2 = FileFindFirstFile($sFP & $sCriteria); and checked with the criteria.
                        If $iH2 <> -1 Then
                            Do
                                $sCF2 = FileFindNextFile($iH2)
                                If @error Then
                                    FileClose($iH2)
                                    ExitLoop
                                EndIf
                                If $sCF2 = '.' Or $sCF2 = '..' Then ContinueLoop
                                $sOutPut = $sOutPut & $sFP & $sCF2 & @LF;Found items are put in the Output.
                            Until 0
                        EndIf
                    EndIf
                Until 0
            EndIf
            $sBuffer = StringReplace($sBuffer, @CR & $sCS & @LF, '')
        Until $sBuffer = ''
    EndIf

    If $sOutPut = '' Then
        $aNull[0] = 0
        Return $aNull
    Else
        Return StringSplit(StringTrimRight($sOutPut, 1), @LF)
    EndIf
EndFunc   ;==>_FileSearch

Func _Quick_Sort(ByRef $SortArray, $First, $Last);Larry's code
    Dim $Low, $High
    Dim $Temp, $List_Separator

    $Low = $First
    $High = $Last
    $List_Separator = StringLen($SortArray[($First + $Last) / 2])
    Do
        While (StringLen($SortArray[$Low]) < $List_Separator)
            $Low = $Low + 1
        WEnd
        While (StringLen($SortArray[$High]) > $List_Separator)
            $High = $High - 1
        WEnd
        If ($Low <= $High) Then
            $Temp = $SortArray[$Low]
            $SortArray[$Low] = $SortArray[$High]
            $SortArray[$High] = $Temp
            $Low = $Low + 1
            $High = $High - 1
        EndIf
    Until $Low > $High
    If ($First < $High) Then _Quick_Sort($SortArray, $First, $High)
    If ($Low < $Last) Then _Quick_Sort($SortArray, $Low, $Last)
EndFunc   ;==>_Quick_Sort

#EndRegion -> Functions

Share this post


Link to post
Share on other sites



Fran,

I can see no reason why the button should not reappear - and it does when I run the script. But then I have had to comment out so much of your script to get it to run that I have not really run "your script" at all. :)

A couple of suggestions:

1. Check the ControlID of $but1 just before the 2 $GUI_HIDE/SHOW lines affecting it - use a MsgBox or ConsoleWrite to get the value of the variable. It does not look as if you ever change it, but we are looking for any clue at present.

2. Try altering the order you $GUI_SHOW the controls at the end of the $butBack code. Perhaps there is an ordering problem - in particular put $but1 before $box1.

Let me know the result. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Look at this - GUICtrlSetData($box1, "Setup Details")

might want to change to GUICtrlSetData($box1, $GUI_SHOW)

Mmmmmmm.... Would love to see how you get that to work.

M23,

I have played around with the order, but get the same result.

I have found only a few instances where I make changes to the button:

1. When I create the button, I disable it until the first file is downloaded.

2. After the file is loaded, the button is enabled

3. When I click the button, it is hidden

4. When I click the back button, I show it again

I'm busy running something else that's taking aaaaaages, so as soon as it's finished I will do the msgbox check you suggested and let you know.

F

Share this post


Link to post
Share on other sites

Mmmmmmm.... Would love to see how you get that to work.

sorry about that - i deleted my post, as i knew that i read the function name wrong


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

sorry about that - i deleted my post, as i knew that i read the function name wrong

No problem :)

M23,

I have added the message box to check the result of GUICtrlSetState($but1, $GUI_SHOW) - It returns '0' (failure)

Would be nice if it gave me a reason why ;)

Fran

Share this post


Link to post
Share on other sites

Here's something strange:

Not sure how I got to this ;)

I commented out the part where I delete all my labels... and? It works!

If I put the GUICtrlSetState($but1, $GUI_SHOW) before deleting the labels and inputboxes, it shows, but then disappears again. So, it must have something to do with this piece of code.

For $i = 0 To $iMax - 1
                    GUICtrlDelete($tabItem[$i])
                    GUICtrlDelete($labcode[$i])
                    GUICtrlDelete($companyname[$i])
                    GUICtrlDelete($afftype[$i])
                    GUICtrlDelete($sitename[$i])
                    GUICtrlDelete($issub[$i])
                    GUICtrlDelete($sublabcode[$i])
                    GUICtrlDelete($maincompany[$i])
                    GUICtrlDelete($labelcompanyname[$i])
                    GUICtrlDelete($labellabcode[$i])
                    GUICtrlDelete($labelpurl[$i])
                    GUICtrlDelete($labelmain[$i])
                    GUICtrlDelete($labelmainlabcode[$i])
                    GUICtrlDelete($labelDLOutput[$i])
                    GUICtrlDelete($inputcompanyname[$i])
                    GUICtrlDelete($inputtype[$i])
                    GUICtrlDelete($inputlabcode[$i])
                    GUICtrlDelete($inputpurl[$i])
                    GUICtrlDelete($inputmain[$i])
                    GUICtrlDelete($inputmainlabcode[$i])
                    GUICtrlDelete($inputDLOutput[$i])
                    GUICtrlDelete($inputCDOutput[$i])
                    GUICtrlDelete($outputDLbasicEXE[$i])
                    GUICtrlDelete($outputDLstdEXE[$i])
                    GUICtrlDelete($outputDLbasicZIP[$i])
                    GUICtrlDelete($outputDLstdZIP[$i])
                    GUICtrlDelete($outputISO[$i])
                Next
                
                $result = GUICtrlSetState($but1, $GUI_SHOW)
                MsgBox(0, "", "but1 show: " & $result)

I have commented out only GUICtrlDelete($tabItem[$i]) line, but it still fails.

I don't get it.

Fran

Edit:

Here is a full ConsoleWrite result:

but1 hide: 1
butback show: 1
Delete tabItem[$i]: 0
Delete labcode[$i]: 0
Delete companyname[$i]: 0
Delete afftype[$i]: 0
Delete sitename[$i]: 0
Delete issub[$i]0
Delete sublabcode[$i]: 0
Delete maincompany[$i]: 0
Delete labelcompanyname[$i]: 0
Delete labellabcode[$i]: 0
Delete labelpurl[$i]: 0
Delete labelmain[$i]: 0
Delete labelmainlabcode[$i]: 0
Delete labelDLOutput[$i]: 0
Delete inputcompanyname[$i]: 0
Delete inputtype[$i]: 0
Delete inputlabcode[$i]: 0
Delete inputpurl[$i]: 0
Delete inputmain[$i]: 0
Delete inputmainlabcode[$i]: 0
Delete inputDLOutput[$i]: 0
Delete inputCDOutput[$i]: 0
Delete outputDLbasicEXE[$i]: 1
Delete outputDLstdEXE[$i]: 0
Delete outputDLbasicZIP[$i]: 0
Delete outputDLstdZIP[$i]: 0
Delete outputISO[$i]: 0
but1 show: 0

Maybe I must add that just before this piece of code I delete the tab.

Fran

Share this post


Link to post
Share on other sites

Fran,

Mystery solved. :shocked:

Most of the things you are using GUICtrlDelete upon in that section of code are variables, not Controls. By chance one of these variables just happens to be the same as the ControlID of the Button - hence you are deleting it. :)

You only need to delete the controls you have created using a GUICtrlCreate* command - not variables that you create like this:

$labcode[$i] = StringStripWS($aArray[4], 3)

When you create a controlusing a GUICtrlCreate* command, AutoIt returns a ControlID - this is actually an index to an internal array in which AutoIt keeps track of its controls. You use this ControlID to indicate to AutoIt which control you are referring to when you use the GUICtrl* commands later in the script.

Simple variables created as in the line above are just that - a space in AutoIt's memory which holds a particular value. Depending on its scopr, it is either kept while the script is running (Global) or automatically deleted when the function ends (Local). You certainly do not need to use GUICtrlDelete on it.

So the solution to your problem is to check which of the GUICtrlDelete lines actually refer to controls - those you keep. Any which do not refer to controls - delete. Then you will not be deleting your button because one of the variables just happens to have the same value as the button ControlID. ;)

All clear? ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

;)

Learnt something new.. thank you.

I have also figured out that if I delete the tab, it automatically seems to delete all the controls created within it, so I do not need to delete any of the controls.

Does that sound right?

Fran

Share this post


Link to post
Share on other sites

Fran,

Deleting a GUI certainly deletes all controls within it - I have no idea if a deleting a tab acts in the same way, although I am quite prepared to believe that it does. I would play safe - delete all the contols on the tab and then finally the tab itself. :)

I am glad we got to the bottom of that. As I said above I had to comment out so much of your script to get it to run that I was not really debugging "your" script at all - which makes debugging pretty difficult. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

100% - if I first delete the controls and then the tabitems and lastly the tab, I get sucess result on all GUICtrlDelete commands.

So, I think it's safe to say that deleting the tab works the same as deleting a gui (all controls are deleted).

;)

Enjoy your weekend!

Fran

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  
Followers 0