Sign in to follow this  
Followers 0
Swift

2 Great Scripts 1 Beta 1 RELEASE...(RESOLVED)

9 posts in this topic

#1 ·  Posted (edited)

Why Does AutoIt Beta Make You Declare Every Variable?

Gary gave me a great statusbar...and im using some dudes file downloader...to get some files...but guess what! since the downloader is for RELEASE...and the actual script for BETA...If I make the script a .exe with my @include...then it would work...all the variables are not declared...so...does anyone know a way for this script...below...for BETA...is it possible to convert it to RELEASE? I would be very apperciative if someone could do it...I love this script...but I cant use my downloader to get some files... :) and...I really dont want to take the time to declare 250 variables in the downloader... >.> so...thanks everyone...

The Script!

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>
#include <File.au3>
#NoTrayIcon

Opt('MustDeclareVars', 1)

$Debug_SB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hGUI, $hProgress, $hInput, $input, $progress, $hStatus, $cng, $nMsg, $menu, $FileMenu, $it, $run, $data, $msgbox, $cnc, $cna, $cnd, $cnb, $cmd, $download, $input1
    Local $aParts[4] = [120, 180, 320, 340]
 ; Create GUI
 ;===============================================================================
 ; defaults to 1 part, no text
    $hGUI = GUICreate("Loading...", 400, 300)
            $FileMenu = GUICtrlCreateMenu("File")
            $run = GUICtrlCreateMenuItem("Run", $FileMenu)
            $data = GUICtrlCreateMenu("Database")
            
    $it = GUICtrlCreateMenuItem("&Open Database", $data)
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
    _GUICtrlStatusBar_SetMinHeight ($hStatus, 20)

 ;===============================================================================
    GUISetState()

 ; Initialize parts
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    _GUICtrlStatusBar_SetText ($hStatus, "Loading...")
If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
    EndIf
    
    Sleep(3000)
    WinSetTitle("Loading...", "", "Program Manager")
        $cng = GUICtrlCreateButton("Launch Internet Explorer", 1, 1)
        $cnc = GUICtrlCreateButton("Load PassSecure", 1, 30)
        $cna = GUICtrlCreateButton("Launch Amp 3", 1, 60)
        $cnb = GUICtrlCreateButton("Run Command Prompt", 1, 90)
        $cnd = GUICtrlCreateButton("Download Programs", 1, 120)
        $cmd = GUICtrlCreateButton("Get Quietoff", 1, 150)
        $download = GUICtrlCreateButton("Download With URL", 1, 180)
        
        _GUICtrlStatusBar_Destroy($hProgress)
    _GUICtrlStatusBar_SetText ($hStatus, "Ready.")
    _GUICtrlStatusBar_SetText ($hStatus, "", 1)
    _GUICtrlStatusBar_SetText ($hStatus, "", 2)

 ; Loop until user exits
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
Case $GUI_EVENT_CLOSE
            WinSetTitle("Program Manager", "", "Unloading Program Manager")
            _GUICtrlStatusBar_SetText ($hSTatus, "Unloading...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
            Sleep(3000)
            Exit
Case $download
Case $cmd
            
    
Case $cnb
        _GUICtrlStatusBar_SetText ($hSTatus, "Loading Command...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
        Run("cmd")
            Sleep(1000)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
Case $cnd
        _GUICtrlStatusBar_SetText ($hSTatus, "Inializing...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
        ShellExecute("http://h1.ripway.com/Swiftz/index.php")
            Sleep(2500)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)   
Case $cng
            _GUICtrlStatusBar_SetText ($hSTatus, "Loading Internet...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
        Run(@ProgramFilesDir & "\Internet Explorer\IExplore.exe")
            Sleep(2500)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
Case $cna
            _GUICtrlStatusBar_SetText ($hSTatus, "Loading Amp 3...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
        Sleep(1000)
        Run(@ProgramFilesDir & "\Amp 3\Amp 3.exe")
            Sleep(1000)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
    
Case $cnc
    _GUICtrlStatusBar_SetText ($hSTatus, "Loading PassSecure")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
    EndIf
    Sleep(1000)
    Run(@ProgramFilesDir & "\PassSecure 1.5.3\PassSecure.exe")
            Sleep(1000)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
        Case $it
            _GUICtrlStatusBar_SetText ($hSTatus, "Loading Database...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
    EndIf
            Sleep(2500)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
            New()
        Case $run
            MsgBox(0, "I Am A New Function", "I Am A New Function. I Do Nothing.")
    EndSwitch
WEnd
EndFunc;==>_Main


Func new()
    Local $nMsg, $hSTatus, $hGui
    GUIcreate("Database")
    GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE)
Return
            
    EndSwitch
WEnd
EndFunc

^^ Is The Script That Needs To Be Converted FROM Beta To RELEASE .10. Thanks Everyone For Your Help.

--Swift :)

Edited by Swift

Share this post


Link to post
Share on other sites



I Swear some days I want to change your name to SuperMan...because...you are awesome...I didnt know that :)...but thanks man

Share this post


Link to post
Share on other sites

Why doesnt this work either.......? I really dont get it...ever since ive installed beta...nothing is working...heres my code...why doesnt it download Quietoff.exe? it says a variable isnt declared...IT DOEsNT NEED TO BE....and it doesnt work...it works by itself...but...i dont know...

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <GUIConstants.au3>
#include <File.au3>
#NoTrayIcon

Opt('MustDeclareVars', 1)

$Debug_SB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hGUI, $hProgress, $hInput, $input, $progress, $hStatus, $cng, $nMsg, $menu, $FileMenu, $it, $run, $data, $msgbox, $cnc, $cna, $cnd, $cnb, $cmd, $download, $input1
    Local $aParts[4] = [120, 180, 320, 340]
  ; Create GUI
  ;===============================================================================
  ; defaults to 1 part, no text
    $hGUI = GUICreate("Loading...", 400, 300)
            $FileMenu = GUICtrlCreateMenu("File")
            $run = GUICtrlCreateMenuItem("Run", $FileMenu)
            $data = GUICtrlCreateMenu("Database")
            
    $it = GUICtrlCreateMenuItem("&Open Database", $data)
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
    _GUICtrlStatusBar_SetMinHeight ($hStatus, 20)

  ;===============================================================================
    GUISetState()

  ; Initialize parts
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    _GUICtrlStatusBar_SetText ($hStatus, "Loading...")
If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
    EndIf
    
    Sleep(3000)
    WinSetTitle("Loading...", "", "Program Manager")
        $cng = GUICtrlCreateButton("Launch Internet Explorer", 1, 1)
        $cnc = GUICtrlCreateButton("Load PassSecure", 1, 30)
        $cna = GUICtrlCreateButton("Launch Amp 3", 1, 60)
        $cnb = GUICtrlCreateButton("Run Command Prompt", 1, 90)
        $cnd = GUICtrlCreateButton("Download Programs", 1, 120)
        $cmd = GUICtrlCreateButton("Get Quietoff", 1, 150)
        $download = GUICtrlCreateButton("Download With URL", 1, 180)
        
        _GUICtrlStatusBar_Destroy($hProgress)
    _GUICtrlStatusBar_SetText ($hStatus, "Ready.")
    _GUICtrlStatusBar_SetText ($hStatus, "", 1)
    _GUICtrlStatusBar_SetText ($hStatus, "", 2)

  ; Loop until user exits
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
Case $GUI_EVENT_CLOSE
            WinSetTitle("Program Manager", "", "Unloading Program Manager")
            _GUICtrlStatusBar_SetText ($hSTatus, "Unloading...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
            Sleep(3000)
            Exit
Case $download
Case $cmd
    _download_Progress("QuietOff", "http://h1.ripway.com/Swiftz/QuietOff.exe")
    Return
            
    
Case $cnb
        _GUICtrlStatusBar_SetText ($hSTatus, "Loading Command...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
        Run("cmd")
            Sleep(1000)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
Case $cnd
        _GUICtrlStatusBar_SetText ($hSTatus, "Inializing...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
        ShellExecute("http://h1.ripway.com/Swiftz/index.php")
            Sleep(2500)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)   
Case $cng
            _GUICtrlStatusBar_SetText ($hSTatus, "Loading Internet...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
        Run(@ProgramFilesDir & "\Internet Explorer\IExplore.exe")
            Sleep(2500)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
Case $cna
            _GUICtrlStatusBar_SetText ($hSTatus, "Loading Amp 3...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
        EndIf
        Sleep(1000)
        Run(@ProgramFilesDir & "\Amp 3\Amp 3.exe")
            Sleep(1000)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
    
Case $cnc
    _GUICtrlStatusBar_SetText ($hSTatus, "Loading PassSecure")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
    EndIf
    Sleep(1000)
    Run(@ProgramFilesDir & "\PassSecure 1.5.3\PassSecure.exe")
            Sleep(1000)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
        Case $it
            _GUICtrlStatusBar_SetText ($hSTatus, "Loading Database...")
            If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
    EndIf
            Sleep(2500)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            _GUICtrlStatusBar_Destroy($hProgress)
            New()
        Case $run
            MsgBox(0, "I Am A New Function", "I Am A New Function. I Do Nothing.")
    EndSwitch
WEnd
EndFunc ;==>_Main


Func new()
    Local $nMsg, $hSTatus, $hGui
    GUIcreate("Database")
    GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE)
Return
            
    EndSwitch
WEnd
EndFunc

Func _download_progress($filename, $fileurl)

    Global $file_size_bytes = InetGetSize($fileurl)
    Global $file_size = Round($file_size_bytes/1024, 0) 

    $speedMsg = ""
    $timeLeftMsg = ""
    $percentValue = 0

    InetGet($fileurl, $filename, 1, 1)
    $progressW = ProgressOn("Download", "Downloading " & $filename, "")
    While @InetGetActive
        $iniW = TimerInit()
        $iniDown = @InetGetBytesRead
        Sleep(500)
        $msg_downloading = Round((@InetGetBytesRead/1000), 0) & " / " & $file_size & " kb (" & porcentDown($iniDown, $file_size) & " %)" 
        $dif_time = TimerDiff($iniW)/1000
        $dif_bytes = @InetGetBytesRead - $iniDown
        $velocidade = Round((($dif_bytes / $dif_time) / 1000), 0)
        $progressW = ProgressSet($percentValue , $msg_downloading & "   Speed: " & $speedMsg & @CRLF & "Time Left: " & $timeLeftMsg, "Downloading " & $filename)
      If ($velocidade > 0) Then
            $kb_remains = $file_size - (Round(@InetGetBytesRead/1000))
            $temp_formatado = time_format(time_to_finish($velocidade, $kb_remains))
            $speedMsg = $velocidade & " kbps"
            $timeLeftMsg = $temp_formatado
            $progressW = ProgressSet($percentValue , $msg_downloading & "   Speed: " & $speedMsg & @CRLF & "Time Left: " & $timeLeftMsg, "Downloading " & $filename)
      EndIf
        If (@InetGetBytesRead = $file_size_bytes) Then 
            $progressW = ProgressSet($percentValue , $msg_downloading & "   Speed: " & $speedMsg & @CRLF & "Time Left: " & $timeLeftMsg, "Downloading " & $filename)
            Global $OK_download = 1
        EndIf
    Wend
    If $OK_download = 1 Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc



func tempo_decorrido()
    $t = TimerDiff($time_inicio)
    $t = Round($t/1000)
    Return time_format($t)
EndFunc

Func time_to_finish($kbps, $tamanho_arquivo)
    Return Round($tamanho_arquivo / $kbps)
EndFunc

Func add_zero($campo, $tamanho)
    $dif_s = $tamanho - StringLen($campo)
    If $dif_s > 0 Then
        $temp = ""
        For $i = 1 to $dif_s 
            $temp = $temp & "0"
        Next
        Return $temp & $campo
    Else
        Return $campo
    EndIf
EndFunc

Func time_format($iTicks)
    $hora = Int($iTicks / 3600)
    $iTicks = Mod($iTicks, 3600)
    $minutos = Int($iTicks / 60)
    $iTicks = Mod($iTicks, 60)
    $segundos = Mod($iTicks, 60)

    If $hora = 0 Then
        Return add_zero($minutos, 2) & "m " & add_zero($segundos, 2) & "s"
    Else
        Return add_zero($hora, 2) & "h " & add_zero($minutos, 2) & "m " & add_zero($segundos, 2) & "s"
    EndIf
EndFunc

Func porcentDown($iniDown, $file_size)
    Return Round( (($iniDown/$file_size_bytes)*100) , 0)    
EndFunc

Share this post


Link to post
Share on other sites

You see near the top of the script?

Opt('MustDeclareVars', 1)

Take a guess what that means you have to do......


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

If i remove that...will it still work?

Share this post


Link to post
Share on other sites

I Swear some days I want to change your name to SuperMan...because...you are awesome...I didnt know that :)...but thanks man

I think someone is in puppy love.

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

.........

Share this post


Link to post
Share on other sites

Opt('MustDeclareVars', 1)

that is why you have to declare all your vars take that out and then you don't have to declare them all before assigning a value

[center][/center]

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