Jump to content
Sign in to follow this  
AcidCorps

Trouble with combining FileReadLine & InetGet

Recommended Posts

AcidCorps

I'm trying to download a link that is in Setup.ini using Igetnet.

this is the script I have.

$file = FileOpen("setup.ini", 0)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open setup.ini attempting to re-downlaod", 5)
    Exit
EndIf
While 1
    $line = FileReadLine($file)
    $downloadlink = FileReadLine("setup.ini", 2) 
    If @error = -1 Then MsgBox(0, "Error","Error - Unable to read setup.ini please re-download setup package")
    WEnd
FileClose($file)
ProgressOn("Downloading File...","", "", -1, -1, 16)
    InetGet($downloadlink, , "Base.exe", 1, 1)
    $FileSize = InetGetSize($downloadlink, )/1048576
    While @InetGetActive
        $filedownload = round(@InetGetBytesRead/1048576, 2)
        $Percent = Round(($filedownload/$FileSize)*100)
        ProgressSet($Percent,"Downloaded - " & $filedownload & " Mb")
        Sleep(250)
    Wend
ProgressOff()

Setup.ini looks like this

Download: 
http://private.website.com/privatefolder/privatefile.exe

I start the script and nothing happens until I click the system tray icon and it says the script it paused

Share this post


Link to post
Share on other sites
/dev/null

I start the script and nothing happens until I click the system tray icon and it says the script it paused

your script is trapped in the first while loop. Look at the code and re-think what you are trying to do. Also, check the error code after every function call.

BTW: Maybe it's better/easier to make the ini file a "real" ini file and use IniRead() to get the download link.

[Download]

url = http://whaterver.com/file.exe


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
poisonkiller

Try if this works:

$file = FileOpen("setup.ini", 0)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open setup.ini attempting to re-downlaod", 5)
    Exit
EndIf
$downloadlink = FileReadLine($file, 2)
If @error = -1 Then MsgBox(0, "Error","Error - Unable to read setup.ini please re-download setup package")
FileClose($file)
ProgressOn("Downloading File...","", "", -1, -1, 16)
$FileSize = InetGetSize($downloadlink)
    InetGet($downloadlink, "Base.exe", 1, 1)
    While @InetGetActive
        $filedownload = round(@InetGetBytesRead/1048576, 2)
        $Percent = Round(($filedownload/$FileSize)*100)
        ProgressSet($Percent,"Downloaded - " & $filedownload & " Mb")
        Sleep(250)
    Wend
ProgressOff()

Share this post


Link to post
Share on other sites
AcidCorps

works like a charm, thank you

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  

×