Jump to content

InetGet


Recommended Posts

Hello...

Can anyone tell me if is possible do one think like this...

If InetGet = 0 Then
Exit
If InetGet >(over) 0 Then
MsgBox (xxxx)

Is this possible?

I want make a program for download a file that come every week, with a diferent version, so for i dont still wait all days, i put this script running...

Link to comment
Share on other sites

Take a look at _INetGetSource this function will allow you to get the page. You can scan the page for the file version.

It goes something like this.

#include <INet.au3>
if (_INetGetSource('www.autoitscript.com') = "New Version if you know before hand or you can use other algorithm to find it") Then
MsgBox (xxxx)
else
Exit
Endif
Edited by WolfWorld
Link to comment
Share on other sites

Well...

Dont work... nothing happen...

Btw...

the download link is "http://89.xxx.215.204/download/xxxx_1.35.zip"

The next version will be 1.36.zip...

(i put some "x" for no1 know what is the site and program for safe...

Edited by NEMESISaka
Link to comment
Share on other sites

I used this:

$filename = "C:\xxxx_1.35.zip" ; Full path of the local name to save

While FileExists($filename) = 0
    InetGet("http://89.xxx.215.204/download/xxxx_1.35.zip"), $filename, 1, 1)
    While @InetGetActive
        Sleep(500)
    WEnd
WEnd

Hope this help you..

Edit1: Code Typo error.

Edited by nfaustin
[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]
Link to comment
Share on other sites

I used this:

$filename = "xxxx_1.35.zip" ; Local name to save

While FileExists($filename) = 0
    InetGet("http://89.xxx.215.204/download/xxxx_1.35.zip"), $filename, 1, 1)
    While @InetGetActive
        Sleep(500)
    WEnd
WEnd

Hope this help you..

I test your script and nothing...

I need a script that try download the file, if file is less than 1 byte, is because no exist, so after 30 secs try again download that file...

because if i try download with my script a file that no exist, i will get allways the zip, that is what im trying donwload, on my desktop, but with 0 bytes...

Link to comment
Share on other sites

I test your script and nothing...

I need a script that try download the file, if file is less than 1 byte, is because no exist, so after 30 secs try again download that file...

because if i try download with my script a file that no exist, i will get allways the zip, that is what im trying donwload, on my desktop, but with 0 bytes...

You don't say if you are you using the Beta or the Production version of AutoIt? If Beta, see InetGet broken in Beta.

Link to comment
Share on other sites

That script is working for me even less than 1 byte.

And I used production version.

Maybe has to do with AutoIt version?

Kindly check..

[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]
Link to comment
Share on other sites

You don't say if you are you using the Beta or the Production version of AutoIt? If Beta, see InetGet broken in Beta.

Im using the Version 1.76...

btw...

I will show all my script...

#include <zip.au3> 

$SBotCopy = "SBotCopy4SBotChecker.exe"
$FileName = "SBot_1.35.zip"
$URL = "http://89.146.215.204/download/SBot_1.35.zip"
$All = 2 ;If $All = 0 this will only download the SBot, If $All = 1 this will download the SBot and extract, 
;If $All = 2 this will download, extract and copy to your bot folders...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Sleep(100)
If $All = 0 Or 1 Or 2 Then
    InetGet ($URL,@DesktopDir & "\" & "SBot_1.35.zip",1,0)
    While @InetGetActive
        TrayTip("Downloading","Download=" & @InetGetBytesRead,10,16)
        Sleep(250)
    WEnd    
EndIf
Sleep(100)
If $All = 0 Then
    Exit
    
ElseIf $All = 1 or 2 Then
    _Zip_Unzip ("C:\Documents and Settings\NEMESIS\Ambiente de trabalho\SBot_1.35.zip", "SBot_1.35.exe", @DesktopDir, 1)
EndIf
Sleep(5000)
If $All = 2 Then
    Run(@DesktopDir&"\"&$SBotCopy,@DesktopDir)
EndIf

That is my script...

Btw... @InetGetBytesRead no is working...

And i want that InetGet download the follow file, only if exist, if no exist inetget will try again after 30 sec...

And do this loop allways...

But with this script, if file dont exist, i got a zip on my desktop with the name of file, but with 0 bytes...

Edited by NEMESISaka
Link to comment
Share on other sites

I got your point.

You need to check first if the file exist? right? Then use this.

$fileName = @DesktopDir & "\" & "SBot_1.35.zip"
$URL = "http://89.146.215.204/download/SBot_1.35.zip"

While 1
    $size = InetGetSize($URL) ; Check the size of the file, 0 if not exist
    MsgBox(0, "Size of remote file:", $size)
    If $size <> 0 Then
        While 1
            While FileExists($filename) = 0
                InetGet($URL,$fileName, 1, 1)
                While @InetGetActive
                    TrayTip("Downloading","Downloading " & $filename & " file...",10,16)
                    Sleep(1000)
                WEnd
            WEnd
            Sleep(1000)

            ; DOuble check if the file successfully download.
            If FileExists($filename) = 1 Then
                If FileGetSize($filename) = 0 Then
                    FileDelete($filename)
                    MsgBox(0,'',' Failed to download. Continue')
                Else
                    MsgBox(0,'',' Download Finished')
                    ExitLoop
                EndIf
            EndIf
        WEnd
        ExitLoop
    Else
        Sleep(30000) ; Sleep 30 seconds
    EndIf
WEnd
Edited by nfaustin
[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]
Link to comment
Share on other sites

Are you sure?  The latest production is v3.3.0.0 and the Beta is v3.3.1.1.  Did AutoIt even have InetGet back in v1.76?

@PartyPooper

Maybe he mention about the Scite version? It is closer.   :D

Edited by nfaustin
[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]
Link to comment
Share on other sites

I got your point.

You need to check first if the file exist? right? Then use this.

$fileName = @DesktopDir & "\" & "SBot_1.35.zip"
$URL = "http://89.146.215.204/download/SBot_1.35.zip"

While 1
    $size = InetGetSize($URL) ; Check the size of the file, 0 if not exist
    MsgBox(0, "Size of remote file:", $size)
    If $size <> 0 Then
        While 1
            While FileExists($filename) = 0
                InetGet($URL,$fileName, 1, 1)
                While @InetGetActive
                    TrayTip("Downloading","Downloading " & $filename & " file...",10,16)
                    Sleep(1000)
                WEnd
            WEnd
            Sleep(1000)

            ; DOuble check if the file successfully download.
            If FileExists($filename) = 1 Then
                If FileGetSize($filename) = 0 Then
                    FileDelete($filename)
                    MsgBox(0,'',' Failed to download. Continue')
                Else
                    MsgBox(0,'',' Download Finished')
                    ExitLoop
                EndIf
            EndIf
        WEnd
        ExitLoop
    Else
        Sleep(30000) ; Sleep 30 seconds
    EndIf
WEnd

This work^^

Thank you alot!!

PartyPooper... well... i see on wrong side... that is my SciTE version... the autoit version is : 3.2.12.1

Edited by NEMESISaka
Link to comment
Share on other sites

Glad to help.

Actually, I had similar script like this.

I just misunderstood your problem description. :D

[font="Palatino Linotype"][size="2"]*** The information contained in this post should be considered and certified WORKS ON MY MACHINE ***[/size][/font][font="Palatino Linotype"][size="2"] [/size][/font]
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...