Jump to content

[SOLVED] Hiding Labels/Controls


zackrspv
 Share

Recommended Posts

Hum, while i Know how to hide them, they don't seem to hide when I want them too. Like, for example, when I download a file, the progress bar, download % and download speed will show up; but if i click 'stop download' the progress bar will disappear, but the lables will not, even though i have the $GUI_HIDE command right in line with everything else. I'm so confused.

KEEP IN MIND THIS IS MY FIRST MAJOR SCRIPT, so please don't be too angry with how i wrote it:

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=Title
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Title
#AutoIt3Wrapper_Res_Description=Title
#AutoIt3Wrapper_Res_Fileversion=0.0.10
#AutoIt3Wrapper_Res_LegalCopyright=GPL
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>

$pass = InputBox("Password", "Password: ", "", "*", 132, 89, "-1", "-1", "90")
if $pass = "blahblahblah" Then
Else
    MsgBox(0, "ERROR", "Invalid Password, please try again, or contact the system administrator!")
    Exit
EndIf

$atd = ""
$doned = ""
$status = ""
$downfile = ""
$FileName = ""
$FileURL = ""
$FileSize = ""
$launch = ""
$delete = ""
$redown = ""
$filelabel = ""

GUICtrlSetState($launch, $GUI_HIDE)
GUICtrlSetState($delete, $GUI_HIDE)
GUICtrlSetState($status, $GUI_HIDE)
GUICtrlSetState($downfile, $GUI_HIDE)
GUICtrlSetState($filelabel, $GUI_HIDE)

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Stuff", 296, 563, 284, 232)
$Tab1 = GUICtrlCreateTab(8, 8, 281, 418)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$Group1 = GUICtrlCreateGroup("Status", 8, 440, 281, 105)

FileDelete("ini.ini")

$getini = InetGet("http://server/down/files.ini", "cini.ini", 1, 0)

$IniSize = InetGetSize("http://server/down/files.ini")
ProgressOn("Fetching Configuration...", "Grabbing configuration file from server...")
While @InetGetActive
    $Percentage = @InetGetBytesRead * 100 / $IniSize
    ProgressSet($Percentage, "Downloaded " & @InetGetBytesRead & " of " & $IniSize & " bytes", "Downloading Configuration file.")
    Sleep(250)
WEnd
ProgressOff()

If $getini = "1" Then
; read ini file so as to fill out proper combo boxes
    $cData = IniRead("cini.ini", "app", "app", "app.exe")
    $cPath = IniRead("cini.ini", "app", "appath", "http://server.com/app/")
    
    $eData = IniRead("cini.ini", "a2", "a2Apps", "a2apps.exe")
    $ePath = IniRead("cini.ini", "a2", "a2Path", "http://server.com/a2/")
    
    $rData = IniRead("cini.ini", "a3", "a3Apps", "a3apps.exe")
    $rPath = IniRead("cini.ini", "a3", "a3Path", "http://server.com/a3/")
    
    $gData = IniRead("cini.ini", "a4", "a4Apps", "a4apps.exe")
    $gPath = IniRead("cini.ini", "a4", "a4Path", "http://server.com/a4/")

Else
    MsgBox(0, "Failed to get INI", "Unable to get configuration file from server. " & @LF & "Please check your internet connection, or it continues, the server may be down.")
    Exit
EndIf

If _OSBit2() = "64" Then
    $winDir = @WindowsDir & "\syswow64\"
    $winReg = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\"
    GUICtrlCreateLabel("64 Bit Operating System", 82, 548, 193, 75)
Else
    $winDir = @WindowsDir & "\system32\"
    $winReg = "HKEY_LOCAL_MACHINE\SOFTWARE\"
    GUICtrlCreateLabel("32 Bit Operating System", 82, 548, 193, 75)
EndIf

Func _OSBit2()
    Local $tOS = DllStructCreate("char[256]")
    Local $aGSWD = DllCall("Kernel32.dll", "int", "GetSystemWow64Directory", "ptr", DllStructGetPtr($tOS), "int", 256)
    If IsArray($aGSWD) And DllStructGetData($tOS, 1) Then Return 64
    Return 32
EndFunc ;==>_OSBit2
$c72 = ""
$c75 = ""

$progress = GUICtrlCreateProgress(8, 499, 279, 25, 0)
GUICtrlSetState($progress, $GUI_HIDE)

$TabSheet1 = GUICtrlCreateTabItem("apps")
    $List1 = GUICtrlCreateList("", 32, 72, 225, 265)
    GUICtrlSetData(-1, $cData, "apps.exe")
    $n1 = GUICtrlCreateButton("Get File", 30, 40, 80, 25, 0)
    $a1 = GUICtrlCreateButton("File Information", 160, 40, 90, 25, 0)
    
           GuiCtrlCreateLabel("apps links", 65, 353, 162, 20)
           GuiCtrlSetFont(-1, 9, 600)
           
    $c72 = GuiCtrlCreateLabel("apps 1.1 link", 23, 373, 132, 20)
    $c75 = GuiCtrlCreateLabel("apps 1.2 link", 153, 373, 132, 20)
          GUICtrlSetColor($c72, 0x0000CC)   
          GUICtrlSetColor($c75, 0x0000CC)             
          GuiCtrlSetFont($c72, 9, 400, 4)
          GuiCtrlSetFont($c75, 9, 400, 4)
          
$TabSheet2 = GUICtrlCreateTabItem("app2)
    $List2 = GUICtrlCreateList("", 32, 72, 225, 353)    
    GUICtrlSetData(-1, $eData, "app2.exe")
    $n2 = GUICtrlCreateButton("Get File", 30, 40, 80, 25, 0)
    $a2 = GUICtrlCreateButton("File Information", 160, 40, 90, 25, 0)
    
$TabSheet3 = GUICtrlCreateTabItem("app3")
    $List3 = GUICtrlCreateList("", 32, 72, 225, 353)
    GUICtrlSetData(-1, $rData, "app4")
    $n3 = GUICtrlCreateButton("Get File", 30, 40, 80, 25, 0)
    $a3 = GUICtrlCreateButton("File Information", 160, 40, 90, 25, 0)
    

$TabSheet4 = GUICtrlCreateTabItem("app5")
    $List4 = GUICtrlCreateList("", 32, 72, 225, 353)
    GUICtrlSetData(-1, $gData, "app5")
    $n4 = GUICtrlCreateButton("Get File", 30, 40, 80, 25, 0)
    $a4 = GUICtrlCreateButton("File Information", 160, 40, 90, 25, 0)
    
    
Func getInfo()
    $desc = iniread("cini.ini", "Information", $FileName, "No description found")
            guictrlcreatelabel($desc, 32, 456, 200, 40) 
EndFunc

Func goFile()
Dim $UpdateTimer = TimerInit()
Dim $oldBytesRead = 0
            InetGet($FileURL&$FileName, $FileName, 0, 1)
;~          ProgressOn("", "")
            $cancelbutton = GuiCtrlCreateButton("Stop Downloading", 82, 425, 120, 20)
            $status = "Done"            
            $filelabel = GUICtrlCreateLabel($FileURL&$FileName, 16, 480, 235, 17)
            While @InetGetActive
                GUICtrlSetState($launch, $GUI_HIDE)
                GUICtrlSetState($delete, $GUI_HIDE)
            GUICtrlSetState($progress, $GUI_SHOW)
                $progvalue = (@InetGetBytesRead / $FileSize)*100
                guictrlsetdata($progress, $progvalue)
                
                If TimerDiff($UpdateTimer) > 1000 Then; 1 Second
                $doned = guictrlcreatelabel("Complete: " & (round($progvalue,2)) & "%" &  @LF, 38, 525, 135, 25, 0)
                $atd = guictrlcreatelabel(" at: " & ((@InetGetBytesRead-$oldBytesRead)/1024) & " kB/s" & @LF, 138, 525, 135, 25, 0)
                $oldBytesRead = @InetGetBytesRead
                $UpdateTimer = TimerInit()
       
                EndIf

            $cmsg = GUIGetMsg()
                        If $cmsg = $cancelbutton Then
                            GUICtrlSetState($launch, $GUI_HIDE)
                            GUICtrlSetState($delete, $GUI_HIDE)
                            GUICtrlSetState($downfile, $GUI_HIDE)
                            GUICtrlSetState($filelabel, $GUI_HIDE)
                            GUICtrlSetState($doned, $GUI_HIDE)
                            GUICtrlSetState($atd, $GUI_HIDE)                    
                            InetGet("abort")
                            $status = "Aborted"
                            GUICtrlSetColor($status, 0xCC3300)
                        EndIf
                $Percentage = @InetGetBytesRead * 100 / $FileSize
;~              ProgressSet($Percentage, "Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes", "Downloading " & $FileName)

                sleep(30)
                
            WEnd
;~          ProgressOff()
            GUICtrlSetState($cancelbutton, $GUI_HIDE)
            GUICtrlSetState($progress, $GUI_HIDE)
            
            if $status = "Done" Then
                $downfile = GUICtrlCreateLabel("File Download Completed", 88, 456, 125, 17)
                GUICtrlSetColor($filelabel, 0x4A7023)
                $launch = GUICtrlCreateButton("Launch File", 8, 512, 97, 25, 0)
                $delete = GUICtrlCreateButton("Delete File", 104, 512, 97, 25, 0)
            Else
                            GUICtrlSetState($launch, $GUI_HIDE)
                            GUICtrlSetState($delete, $GUI_HIDE)
                            GUICtrlSetState($downfile, $GUI_HIDE)
                            GUICtrlSetState($filelabel, $GUI_HIDE)
                            GUICtrlSetState($doned, $GUI_HIDE)
                            GUICtrlSetState($atd, $GUI_HIDE)    
            EndIf
            
EndFunc ;==>goFile


GUICtrlSetState(-1,$GUI_SHOW)

GUICtrlCreateTabItem("")

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            filedelete("cini.ini")
            filedelete($FileName)
            Exit
        
        case $c72
            ShellExecute("http://app2.test.et")
            GUICtrlSetColor($c72, 0x660099) 
            
        case $c75
            ShellExecute("http://app1.test.et")
            GUICtrlSetColor($c75, 0x660099) 
            
        case $a1
            $FileName = GUICtrlRead($List1,1)
            call("getInfo")
            
        case $a2
            $FileName = GUICtrlRead($List2,1)
            call("getInfo")
        
        case $a3
            $FileName = GUICtrlRead($List3,1)
            call("getInfo")
        
        case $a4
            $FileName = GUICtrlRead($List4,1)
            call("getInfo")

        Case $n1
            $FileName = GUICtrlRead($List1,1)
            $FileURL = $cPath
            $FileSize = InetGetSize($FileURL&$FileName)
            
            if $FileName = "app3(393).ddd" Then
                $FileURL = "http://www.server.com/app2/"
                $FileSize = InetGetSize($FileURL&$FileName)
            EndIf
            if $FileName = "app4(393).ddd" Then
                $FileURL = "http://www.server.com/app2/"
                $FileSize = InetGetSize($FileURL&$FileName)
            EndIf
            Call("goFile")

        Case $n2
            $FileName = GUICtrlRead($List2,1)
            $FileURL = $ePath
            $FileSize = InetGetSize($FileURL&$FileName)
            Call("goFile")
            
        Case $n3
            $FileName = GUICtrlRead($List3,1)
            $FileURL = $rPath
            $FileSize = InetGetSize($FileURL&$FileName)
            Call("goFile")

        Case $n4
            $FileName = GUICtrlRead($List4,1)
            $FileURL = $gPath
            $FileSize = InetGetSize($FileURL&$FileName)
            Call("goFile")

        case $delete
            $del = FileDelete($FileName)
            GUICtrlSetState($launch, $GUI_HIDE)
            GUICtrlSetState($delete, $GUI_HIDE)
            GUICtrlSetState($downfile, $GUI_HIDE)
            GUICtrlSetState($filelabel, $GUI_HIDE)
            GUICtrlSetState($doned, $GUI_HIDE)
            GUICtrlSetState($atd, $GUI_HIDE)
            
        case $launch
            $check = FileExists($FileName)
            if $check = "1" Then
                ShellExecuteWait($FileName)
            Else
                MsgBox(0,"ERROR", "Unable to launch: " & $FileName & @LF & "Redownloading...")
                Call("goFile")
            EndIf
    EndSwitch
WEnd

I hope y'all can help me out with this. I want to make this look proper. Noted, due to security reasons, i had to change the paths to the files, etc, as well as the descriptions of the applications being referenced, so simply running this script, as it is written above, will not work :)

Thanks!

Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Hum, while i Know how to hide them, they don't seem to hide when I want them too. Like, for example, when I download a file, the progress bar, download % and download speed will show up; but if i click 'stop download' the progress bar will disappear, but the lables will not, even though i have the $GUI_HIDE command right in line with everything else. I'm so confused.

KEEP IN MIND THIS IS MY FIRST MAJOR SCRIPT, so please don't be too angry with how i wrote it:

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=Title
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Title
#AutoIt3Wrapper_Res_Description=Title
#AutoIt3Wrapper_Res_Fileversion=0.0.10
#AutoIt3Wrapper_Res_LegalCopyright=GPL
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>

$pass = InputBox("Password", "Password: ", "", "*", 132, 89, "-1", "-1", "90")
if $pass = "blahblahblah" Then
Else
    MsgBox(0, "ERROR", "Invalid Password, please try again, or contact the system administrator!")
    Exit
EndIf

$atd = ""
$doned = ""
$status = ""
$downfile = ""
$FileName = ""
$FileURL = ""
$FileSize = ""
$launch = ""
$delete = ""
$redown = ""
$filelabel = ""

GUICtrlSetState($launch, $GUI_HIDE)
GUICtrlSetState($delete, $GUI_HIDE)
GUICtrlSetState($status, $GUI_HIDE)
GUICtrlSetState($downfile, $GUI_HIDE)
GUICtrlSetState($filelabel, $GUI_HIDE)

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Stuff", 296, 563, 284, 232)
$Tab1 = GUICtrlCreateTab(8, 8, 281, 418)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$Group1 = GUICtrlCreateGroup("Status", 8, 440, 281, 105)

FileDelete("ini.ini")

$getini = InetGet("http://server/down/files.ini", "cini.ini", 1, 0)

$IniSize = InetGetSize("http://server/down/files.ini")
ProgressOn("Fetching Configuration...", "Grabbing configuration file from server...")
While @InetGetActive
    $Percentage = @InetGetBytesRead * 100 / $IniSize
    ProgressSet($Percentage, "Downloaded " & @InetGetBytesRead & " of " & $IniSize & " bytes", "Downloading Configuration file.")
    Sleep(250)
WEnd
ProgressOff()

If $getini = "1" Then
; read ini file so as to fill out proper combo boxes
    $cData = IniRead("cini.ini", "app", "app", "app.exe")
    $cPath = IniRead("cini.ini", "app", "appath", "http://server.com/app/")
    
    $eData = IniRead("cini.ini", "a2", "a2Apps", "a2apps.exe")
    $ePath = IniRead("cini.ini", "a2", "a2Path", "http://server.com/a2/")
    
    $rData = IniRead("cini.ini", "a3", "a3Apps", "a3apps.exe")
    $rPath = IniRead("cini.ini", "a3", "a3Path", "http://server.com/a3/")
    
    $gData = IniRead("cini.ini", "a4", "a4Apps", "a4apps.exe")
    $gPath = IniRead("cini.ini", "a4", "a4Path", "http://server.com/a4/")

Else
    MsgBox(0, "Failed to get INI", "Unable to get configuration file from server. " & @LF & "Please check your internet connection, or it continues, the server may be down.")
    Exit
EndIf

If _OSBit2() = "64" Then
    $winDir = @WindowsDir & "\syswow64\"
    $winReg = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\"
    GUICtrlCreateLabel("64 Bit Operating System", 82, 548, 193, 75)
Else
    $winDir = @WindowsDir & "\system32\"
    $winReg = "HKEY_LOCAL_MACHINE\SOFTWARE\"
    GUICtrlCreateLabel("32 Bit Operating System", 82, 548, 193, 75)
EndIf

Func _OSBit2()
    Local $tOS = DllStructCreate("char[256]")
    Local $aGSWD = DllCall("Kernel32.dll", "int", "GetSystemWow64Directory", "ptr", DllStructGetPtr($tOS), "int", 256)
    If IsArray($aGSWD) And DllStructGetData($tOS, 1) Then Return 64
    Return 32
EndFunc ;==>_OSBit2
$c72 = ""
$c75 = ""

$progress = GUICtrlCreateProgress(8, 499, 279, 25, 0)
GUICtrlSetState($progress, $GUI_HIDE)

$TabSheet1 = GUICtrlCreateTabItem("apps")
    $List1 = GUICtrlCreateList("", 32, 72, 225, 265)
    GUICtrlSetData(-1, $cData, "apps.exe")
    $n1 = GUICtrlCreateButton("Get File", 30, 40, 80, 25, 0)
    $a1 = GUICtrlCreateButton("File Information", 160, 40, 90, 25, 0)
    
           GuiCtrlCreateLabel("apps links", 65, 353, 162, 20)
           GuiCtrlSetFont(-1, 9, 600)
           
    $c72 = GuiCtrlCreateLabel("apps 1.1 link", 23, 373, 132, 20)
    $c75 = GuiCtrlCreateLabel("apps 1.2 link", 153, 373, 132, 20)
          GUICtrlSetColor($c72, 0x0000CC)   
          GUICtrlSetColor($c75, 0x0000CC)             
          GuiCtrlSetFont($c72, 9, 400, 4)
          GuiCtrlSetFont($c75, 9, 400, 4)
          
$TabSheet2 = GUICtrlCreateTabItem("app2)
    $List2 = GUICtrlCreateList("", 32, 72, 225, 353)    
    GUICtrlSetData(-1, $eData, "app2.exe")
    $n2 = GUICtrlCreateButton("Get File", 30, 40, 80, 25, 0)
    $a2 = GUICtrlCreateButton("File Information", 160, 40, 90, 25, 0)
    
$TabSheet3 = GUICtrlCreateTabItem("app3")
    $List3 = GUICtrlCreateList("", 32, 72, 225, 353)
    GUICtrlSetData(-1, $rData, "app4")
    $n3 = GUICtrlCreateButton("Get File", 30, 40, 80, 25, 0)
    $a3 = GUICtrlCreateButton("File Information", 160, 40, 90, 25, 0)
    

$TabSheet4 = GUICtrlCreateTabItem("app5")
    $List4 = GUICtrlCreateList("", 32, 72, 225, 353)
    GUICtrlSetData(-1, $gData, "app5")
    $n4 = GUICtrlCreateButton("Get File", 30, 40, 80, 25, 0)
    $a4 = GUICtrlCreateButton("File Information", 160, 40, 90, 25, 0)
    
    
Func getInfo()
    $desc = iniread("cini.ini", "Information", $FileName, "No description found")
            guictrlcreatelabel($desc, 32, 456, 200, 40) 
EndFunc

Func goFile()
Dim $UpdateTimer = TimerInit()
Dim $oldBytesRead = 0
            InetGet($FileURL&$FileName, $FileName, 0, 1)
;~          ProgressOn("", "")
            $cancelbutton = GuiCtrlCreateButton("Stop Downloading", 82, 425, 120, 20)
            $status = "Done"            
            $filelabel = GUICtrlCreateLabel($FileURL&$FileName, 16, 480, 235, 17)
            While @InetGetActive
                GUICtrlSetState($launch, $GUI_HIDE)
                GUICtrlSetState($delete, $GUI_HIDE)
            GUICtrlSetState($progress, $GUI_SHOW)
                $progvalue = (@InetGetBytesRead / $FileSize)*100
                guictrlsetdata($progress, $progvalue)
                
                If TimerDiff($UpdateTimer) > 1000 Then; 1 Second
                $doned = guictrlcreatelabel("Complete: " & (round($progvalue,2)) & "%" &  @LF, 38, 525, 135, 25, 0)
                $atd = guictrlcreatelabel(" at: " & ((@InetGetBytesRead-$oldBytesRead)/1024) & " kB/s" & @LF, 138, 525, 135, 25, 0)
                $oldBytesRead = @InetGetBytesRead
                $UpdateTimer = TimerInit()
       
                EndIf

            $cmsg = GUIGetMsg()
                        If $cmsg = $cancelbutton Then
                            GUICtrlSetState($launch, $GUI_HIDE)
                            GUICtrlSetState($delete, $GUI_HIDE)
                            GUICtrlSetState($downfile, $GUI_HIDE)
                            GUICtrlSetState($filelabel, $GUI_HIDE)
                            GUICtrlSetState($doned, $GUI_HIDE)
                            GUICtrlSetState($atd, $GUI_HIDE)                    
                            InetGet("abort")
                            $status = "Aborted"
                            GUICtrlSetColor($status, 0xCC3300)
                        EndIf
                $Percentage = @InetGetBytesRead * 100 / $FileSize
;~              ProgressSet($Percentage, "Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes", "Downloading " & $FileName)

                sleep(30)
                
            WEnd
;~          ProgressOff()
            GUICtrlSetState($cancelbutton, $GUI_HIDE)
            GUICtrlSetState($progress, $GUI_HIDE)
            
            if $status = "Done" Then
                $downfile = GUICtrlCreateLabel("File Download Completed", 88, 456, 125, 17)
                GUICtrlSetColor($filelabel, 0x4A7023)
                $launch = GUICtrlCreateButton("Launch File", 8, 512, 97, 25, 0)
                $delete = GUICtrlCreateButton("Delete File", 104, 512, 97, 25, 0)
            Else
                            GUICtrlSetState($launch, $GUI_HIDE)
                            GUICtrlSetState($delete, $GUI_HIDE)
                            GUICtrlSetState($downfile, $GUI_HIDE)
                            GUICtrlSetState($filelabel, $GUI_HIDE)
                            GUICtrlSetState($doned, $GUI_HIDE)
                            GUICtrlSetState($atd, $GUI_HIDE)    
            EndIf
            
EndFunc ;==>goFile


GUICtrlSetState(-1,$GUI_SHOW)

GUICtrlCreateTabItem("")

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            filedelete("cini.ini")
            filedelete($FileName)
            Exit
        
        case $c72
            ShellExecute("http://app2.test.et")
            GUICtrlSetColor($c72, 0x660099) 
            
        case $c75
            ShellExecute("http://app1.test.et")
            GUICtrlSetColor($c75, 0x660099) 
            
        case $a1
            $FileName = GUICtrlRead($List1,1)
            call("getInfo")
            
        case $a2
            $FileName = GUICtrlRead($List2,1)
            call("getInfo")
        
        case $a3
            $FileName = GUICtrlRead($List3,1)
            call("getInfo")
        
        case $a4
            $FileName = GUICtrlRead($List4,1)
            call("getInfo")

        Case $n1
            $FileName = GUICtrlRead($List1,1)
            $FileURL = $cPath
            $FileSize = InetGetSize($FileURL&$FileName)
            
            if $FileName = "app3(393).ddd" Then
                $FileURL = "http://www.server.com/app2/"
                $FileSize = InetGetSize($FileURL&$FileName)
            EndIf
            if $FileName = "app4(393).ddd" Then
                $FileURL = "http://www.server.com/app2/"
                $FileSize = InetGetSize($FileURL&$FileName)
            EndIf
            Call("goFile")

        Case $n2
            $FileName = GUICtrlRead($List2,1)
            $FileURL = $ePath
            $FileSize = InetGetSize($FileURL&$FileName)
            Call("goFile")
            
        Case $n3
            $FileName = GUICtrlRead($List3,1)
            $FileURL = $rPath
            $FileSize = InetGetSize($FileURL&$FileName)
            Call("goFile")

        Case $n4
            $FileName = GUICtrlRead($List4,1)
            $FileURL = $gPath
            $FileSize = InetGetSize($FileURL&$FileName)
            Call("goFile")

        case $delete
            $del = FileDelete($FileName)
            GUICtrlSetState($launch, $GUI_HIDE)
            GUICtrlSetState($delete, $GUI_HIDE)
            GUICtrlSetState($downfile, $GUI_HIDE)
            GUICtrlSetState($filelabel, $GUI_HIDE)
            GUICtrlSetState($doned, $GUI_HIDE)
            GUICtrlSetState($atd, $GUI_HIDE)
            
        case $launch
            $check = FileExists($FileName)
            if $check = "1" Then
                ShellExecuteWait($FileName)
            Else
                MsgBox(0,"ERROR", "Unable to launch: " & $FileName & @LF & "Redownloading...")
                Call("goFile")
            EndIf
    EndSwitch
WEnd

I hope y'all can help me out with this. I want to make this look proper. Noted, due to security reasons, i had to change the paths to the files, etc, as well as the descriptions of the applications being referenced, so simply running this script, as it is written above, will not work :)

Thanks!

You need to rework your code a bit. You start by setting $launch to be an empty string, then try to treat it like a control and hide it. Instead you should create the controls there so they are global and can be referred to in your functions. If you do not declare variables as global then a control created in a function cannot be referred to outside of that function.

Later you have conditions like this

if $status = "Done" Then
                $downfile = GUICtrlCreateLabel("File Download Completed", 88, 456, 125, 17)
                GUICtrlSetColor($filelabel, 0x4A7023)
                $launch = GUICtrlCreateButton("Launch File", 8, 512, 97, 25, 0)
                $delete = GUICtrlCreateButton("Delete File", 104, 512, 97, 25, 0)
            Else
                            GUICtrlSetState($launch, $GUI_HIDE)
                            GUICtrlSetState($delete, $GUI_HIDE)
                            GUICtrlSetState($downfile, $GUI_HIDE)
                            GUICtrlSetState($filelabel, $GUI_HIDE)
                            GUICtrlSetState($doned, $GUI_HIDE)
                            GUICtrlSetState($atd, $GUI_HIDE)    
            EndIf

but if $Done is not true you can't hide a control that hasn't been created. Instead create all the controls you want at the start. Then in the section for the If $Done say something like

If $done
; show controls
else
;hide them
EndIf

Hide or show controls, don't create them again or you will have duplicate controls but you will have lost the reference the the first ones. For example if you say

$ctrl = GuiCtreateLabel(...

then later say

$ctrl = GuiCreateButton(...

$ctrl now has the identity of the button and you don't know how to refer to the label any more.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

You need to rework your code a bit. You start by setting $launch to be an empty string, then try to treat it like a control and hide it. Instead you should create the controls there so they are global and can be referred to in your functions. If you do not declare variables as global then a control created in a function cannot be referred to outside of that function.

Later you have conditions like this

if $status = "Done" Then
                $downfile = GUICtrlCreateLabel("File Download Completed", 88, 456, 125, 17)
                GUICtrlSetColor($filelabel, 0x4A7023)
                $launch = GUICtrlCreateButton("Launch File", 8, 512, 97, 25, 0)
                $delete = GUICtrlCreateButton("Delete File", 104, 512, 97, 25, 0)
            Else
                            GUICtrlSetState($launch, $GUI_HIDE)
                            GUICtrlSetState($delete, $GUI_HIDE)
                            GUICtrlSetState($downfile, $GUI_HIDE)
                            GUICtrlSetState($filelabel, $GUI_HIDE)
                            GUICtrlSetState($doned, $GUI_HIDE)
                            GUICtrlSetState($atd, $GUI_HIDE)    
            EndIf

but if $Done is not true you can't hide a control that hasn't been created. Instead create all the controls you want at the start. Then in the section for the If $Done say something like

If $done
; show controls
else
;hide them
EndIf

Hide or show controls, don't create them again or you will have duplicate controls but you will have lost the reference the the first ones. For example if you say

$ctrl = GuiCtreateLabel(...

then later say

$ctrl = GuiCreateButton(...

$ctrl now has the identity of the button and you don't know how to refer to the label any more.

Awesome! That's the part i was missing. See told you I was new at this. Ok, so i'll rework that to declare all labels at the start and just selectively hide/show them based on what goes on in the script.

Could you perhaps answer me another? Why does it seem that InetGet takes so much SLOWER to download a file than a simple http download directly from the webserver? For example, i can download using HTTP a 42 mb file at roughly 6-8mb when requesting directly from IE or FF, for example; but when using INETGET, it is less than 2 or 3mb on average.

I assume it's because it doesn't use multiple streams, but i may be wrong here. Is there a way to SPEED up INEtGET?

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Could you perhaps answer me another? Why does it seem that InetGet takes so much SLOWER to download a file than a simple http download directly from the webserver? For example, i can download using HTTP a 42 mb file at roughly 6-8mb when requesting directly from IE or FF, for example; but when using INETGET, it is less than 2 or 3mb on average.

I assume it's because it doesn't use multiple streams, but i may be wrong here. Is there a way to SPEED up INEtGET?

Sorry, don't know about that. Might be worth starting a new thread with that question if searching doesn't help.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...