Jump to content

Recommended Posts

  • Replies 58
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

hi dnsi,

its sure a simple code.

guess you do not understand what is being discussed here.

this code works and does not at different environments. you can try it out and understand what i meant.

:think:

New to script...But getting the hang of it.

  • Moderators
Posted

hi dnsi,

its sure a simple code.

guess you do not understand what is being discussed here.

this code works and does not at different environments. you can try it out and understand what i meant.

:think:

Have you tried the .119 beta jacy_ckw... Valik did something with inetget if I remember correctly.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

Does the VBS file work ? if not it's on your OS settings

(proxy .. security ..ecc)

test it *.vbs :

x = TextFromHTML("http://www.google.com/") 
'WScript.Echo x 
Function TextFromHTML(URL) 
  set ie = createobject("internetexplorer.application") 
  ie.navigate URL 
  do until ie.readystate = 4 : wscript.sleep 10: loop 
  TextFromHTML = ie.document.body.outerHtml
  ie.quit 
End Function 
filename = "google.html" 
Set fso = CreateObject("Scripting.FileSystemObject") 
Set newf = fso.createtextfile(filename) 
newf.WriteLine x 

x = TextFromHTML("http://www.google.com/") 
'WScript.Echo x 
Function TextFromHTML(URL) 
  set ie = createobject("internetexplorer.application") 
  ie.navigate URL 
  do until ie.readystate = 4 : wscript.sleep 10: loop 
  TextFromHTML = ie.document.body.innerHtml
  ie.quit 
End Function 
filename = "google.txt" 
Set fso = CreateObject("Scripting.FileSystemObject") 
Set newf = fso.createtextfile(filename) 
newf.WriteLine x
Posted

Does the VBS file work ? if not it's on your OS settings

(proxy .. security ..ecc)

:( got to explain again...

i managed to get the vbs script to work but the initial problem i started this thread is to highlight that the "Inetget" command in AutoIt does not always work in all environments.

but i will be trying the lastest beta version to check if its working... :think:

New to script...But getting the hang of it.

Posted (edited)

but i will be trying the lastest beta version to check if its working...

yes try it .... all OK here .. win98se IE 5.5sp2 e/o WinXPsp2 pro IE 6.0 and

autoit3 beta 3, 1, 1, 113

#Include "Inet.au3"

 $1 =_INetGetSource("www.google.com")
 MsgBox(0,"",$1)
 InetGet("http://www.google.com","c:\test.htm",1)
InetGet("http://www.autoitscript.com", "C:\mydownload.htm", 1)
Edited by Lapo
Posted

its still not working...

tested with the v3.1.1.120 (beta) too but still having the same problem.

using the example in the help file, the FTP works, i have the readme.txt downloaded.

but when i tested the HTTP there will be an error msg box -1

InetGet("http://www.mozilla.org", "foo.html")
;InetGet("ftp://ftp.mozilla.org/pub/mozilla.org/README", "README.txt", 1)


; Advanced example - downloading in the background
;InetGet("http://www.nowhere.com/somelargefile.exe", "test.exe", 1, 1)

While @InetGetActive
  TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16)
  Sleep(250)
Wend

MsgBox(0, "Bytes read", @InetGetBytesRead)

i do not use the Windows firewall, so i disabled my Zonealarm. so its definitly not any firewall restrictions.

in my office environment it works (of course i cant disable the corporate firewall).

any other advise other than trying with different versions?

i'm very sure some of you out there are having this problem too. look at the history of this thread. :think:

New to script...But getting the hang of it.

Posted (edited)

all working here (zip test too) on win98 and winxp

try again and look on error code

EDIT:

zip test was :

;InetGet("http://www.nowhere.com/somelargefile.zip", "test.zip", 1, 1)

$file =InetGet("http://www.google.com", "test.html")
;Success: Returns 1. 
;Failure: Returns 0. 
MsgBox(262144, "", @error)
$file2 = InetGet("http://google.com", "test2.htm")
MsgBox(262144, "", @error)
$file3 = InetGet("http://66.249.85.104", "test3.htm")
MsgBox(262144, "", @error)
Edited by Lapo
Posted (edited)

the error code was -1 as stated in my previous reply.

:think:

Strange ... from the inetget helpfile :

Return Value

Success: Returns 1.

Failure: Returns 0.

this returns 1 as success and 0 as failure :

$file =InetGet("http://www.google.com", "test.html")
;Success: Returns 1. 
;Failure: Returns 0. 
MsgBox(262144, "", $file)
$file2 = InetGet("http://google.com", "test2.htm")
MsgBox(262144, "", $file2)
$file3 = InetGet("http://66.249.85.104", "test3.htm")
MsgBox(262144, "",$file3)
$file4 = InetGet("http://66.249.85.104", "test3.txt")
MsgBox(262144, "",$file4)

PS:

is inetget really so important ... you have alternatives posted

in this thread

Edited by Lapo
Posted

PS:

is inetget really so important ... you have alternatives posted

in this thread

i know there are other altenative methods to do so, but since i'm trying to create a little program using AutoIt, i should make full use of it. otherwise, why bother to use AutoIt when i can use other methods of scripting languages.

its just a little problem i met and hope someone could help out.

no offence, but thanks all who replied.

New to script...But getting the hang of it.

Posted

Strange ... from the inetget helpfile :

Return Value

Success: Returns 1.

Failure: Returns 0.

this returns 1 as success and 0 as failure :

.............

@Lapo,

Just FYI, it is not that strange. The code that jacky_ckw was reporting a "-1" return from was checking InetGetBytesRead, not the return from InetGet.

@jacky_ckw,

What is it you think is wrong? InetGet works for you at your office. Right? For Http and Ftp. Right? But Http does not work for you at your home. Then the problem seems to be the setup of your home computer... not the InetGet function.

Yes, you will find others in the forum with simular problems - but that does not equate to a problem with the function itself - just the system it is being run on.

Can you get another computer - like a laptop - to test the InetGet function from your home?

@Others,

Does anyone have any other suggestions for jacky_ckw to try on his home system to get InetGet to work with Http?

[size="1"][font="Arial"].[u].[/u][/font][/size]

Posted (edited)

@jacky_ckw,

What is it you think is wrong? InetGet works for you at your office. Right? For Http and Ftp. Right? But Http does not work for you at your home. Then the problem seems to be the setup of your home computer... not the InetGet function

hi herewasplato,

i'm also not sure where the problem is. yes Inetget works in my office but not at home. i know it could be from my computer but i just cant figure out where the problem is from.

i even tried to disabled anti-virus and anti-spyware and zonealarm to make sure no software could be the cause of it but it still fails.

does anyone know which port Inetget uses? port 80? if its port 80 it should definitly work.

now i have no more idea where the problem could come from... :)

Edited by jacky_ckw

New to script...But getting the hang of it.

Posted

...does anyone know which port Inetget uses? port 80? if its port 80 it should definitly work...

I cannot speak to the way that InetGet works. I can only assume that it passes the URL to some part of the operating system. The OS uses different ports for different protocols. (Again, a heavy caveat to the info above: I'm not an AutoIt developer.)

If you are using windows 2000 or XP, you can download/install Active Ports:

http://www.snapfiles.com/get/activeports.html

Once installed, go to the Options > Update Speed and set it to "High". Even at that setting, the tool will miss some connections. I've selected some websites for the code below that should be slow enough to show up on that Active Ports tool:

For $i = 1 To 3
    $resHTTP = InetGet( _
            "http://www.info-techs.com/speedtest500.html", _
            @TempDir & "\junk.html", 1, 0)
    MsgBox(0, "result" & $i, "HTTP " & $resHTTP)
    
    $resFTP = InetGet( _
            "ftp://ftp.newaol.com/aim/win31/setup16.exe", _
            @TempDir & "\junk.junk", 1, 0)
    MsgBox(0, "result" & $i, "HTTP " & $resHTTP & _
    @CR & "FTP " & $resFTP)
Next
I get ports 20 and 21 for FTP and 80 for HTTP.

You might want to uninstall ZoneAlarm for this test... not just "turn it off".

[size="1"][font="Arial"].[u].[/u][/font][/size]

Posted

yes, it is port 80. It uses a componet of Internet Explorer to download. A firewall should not block it because it is actually internet explorer downloading the file.

...but not for the FTP protocol. I can block and unblock the FTP part of the code that I posted by simply blocking/unblocking AutoIt via the XP firewall. Such blocking/unblocking has no effect on the HTTP protocol when using just the XP firewall.

ZoneAlarm watches for programs that "use" other programs to send/receive traffic.

[size="1"][font="Arial"].[u].[/u][/font][/size]

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
  • Recently Browsing   0 members

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