Jump to content

Recommended Posts

Posted

  motionman95 said:

Hello! Is it possible to download files without using InetGet? My client doesn't use IE.

Are you saying that you are writing an AutoIt script for a computer that has IE removed? Or just that this person just does not happen to surf with IE.

InetGet does not launch IE to get the file, but at least IE3 has to be installed/available to AutoIt for the InetGet function to work.

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

Posted

There's a udf here to download files via http:

http://www.autoitscript.com/forum/index.ph...&hl=winhttp

Here's one for FTP:

http://www.autoitscript.com/forum/index.ph...6403&hl=ftp

They both use windows dll's not IE

There is also a command line tool called CURL which I've used for different things.

It's completely stand alone, it will do both FTP and HTTP.

But I'd try those UDF's first they should work for you.

-Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Posted

Are you saying that you are writing an AutoIt script for a computer that has IE removed? Or just that this person just does not happen to surf with IE.

InetGet does not launch IE to get the file, but at least IE3 has to be installed/available to AutoIt for the InetGet function to work.

Yeah I was wondering about that but I didn't want to get into it.

I've seen a process once before but actually removing IE is a hell of a process and really screws over windows.

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Posted

Try using these functions.

_HTTPConnect($host, $port = 80)
_HTTPGet($host, $page, $socket = -1)
_HTTPRead([$socket], [$flag])

Read each for the correct values. But you should be able to get it working :)

Posted

#include <WinHTTP.au3>

Dim $sHost, $sPage
Dim $hOpen, $hConnet, $hOpenRequest
Dim $hFile
Dim $xBuff = ''

$sHost = 'www.autoitscript.com'
$sPage = 'autoit3/files/beta/autoit/pcretest-7.8.exe'

$hOpen = _WinHttpOpen('UserAgent')
$hConnet = _WinHttpConnect($hOpen, $sHost)
$hOpenRequest = _WinHttpOpenRequest($hConnet, 'GET', $sPage);, 'HTTP/1.1', 'Referrer')

_WinHttpSendRequest($hOpenRequest)
_WinHttpReceiveResponse($hOpenRequest)

If _WinHttpQueryDataAvailable($hOpenRequest) Then
    Do
        $xBuff &= _WinHttpReadData($hOpenRequest)
    Until @error = -1
EndIf

_WinHttpCloseHandle($hOpenRequest)
_WinHttpCloseHandle($hConnet)
_WinHttpCloseHandle($hOpen)

$hFile = FileOpen(@ScriptDir & '\pcretest-7.8.exe', 2)
FileWrite($hFile, Binary($xBuff))
FileClose($hFile)oÝ÷ Û­«­¢+ÙÕ¹}!QQAI ÀÌØíͽ­Ðô´Ä°ÀÌØí±ôÀ¤(츸¸)¥´ÀÌØíÉØôQ
AIØ ÀÌØíͽ­Ð°ÁàÈÀÀÀ¤

Posted

InetGet is lookin' better and better. :-)

How about giving more details about the failures that you saw.

"That doesn't work" doesn't tell us much. :-(

Also, can you give the link/file(s) of interest or link/file(s) with similar security setups.

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

Posted

  motionman95 said:

Thanks, authencity. That code doesn't work though...:)

Authenticity's code is failing because of not reading binary. This is fixed script - with error handling:

#include <WinHTTP.au3>

Global $sHost = "www.autoitscript.com"
Global $sPage = "autoit3/files/beta/autoit/pcretest-7.8.exe"

Global $hHttpOpen = _WinHttpOpen()
If @error Then
    MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.")
    Exit
EndIf

Global $hHttpConnect = _WinHttpConnect($hHttpOpen, $sHost)
If @error Then
    MsgBox(48, "Error", "Error specifying the initial target server of an HTTP request.")
    _WinHttpCloseHandle($hHttpOpen)
    Exit
EndIf

Global $hHttpRequest = _WinHttpOpenRequest($hHttpConnect, "GET", "autoit3/files/beta/autoit/pcretest-7.8.exe")
If @error Then
    MsgBox(48, "Error", "Error creating an HTTP request handle.")
    _WinHttpCloseHandle($hHttpConnect)
    _WinHttpCloseHandle($hHttpOpen)
    Exit
EndIf

_WinHttpSendRequest($hHttpRequest)
If @error Then
    MsgBox(48, "Error", "Error sending specified request.")
    _WinHttpCloseHandle($hHttpConnect)
    _WinHttpCloseHandle($hHttpOpen)
    Exit
EndIf

_WinHttpReceiveResponse($hHttpRequest)

If _WinHttpQueryDataAvailable($hHttpRequest) Then

    Global $bChunk, $bData
    While 1
        $bChunk = _WinHttpReadData($hHttpRequest, 2)
        If @error Then ExitLoop
        $bData = _WinHttpBinaryConcat($bData, $bChunk)
    WEnd

    Global $hFile = FileOpen(@ScriptDir & "\pcretest-7.8.exe", 26)
    FileWrite($hFile, $bData)
    FileClose($hFile)

Else

    MsgBox(48, "Error occurred", "No data available. " & @CRLF)

EndIf

_WinHttpCloseHandle($hHttpRequest)
_WinHttpCloseHandle($hHttpConnect)
_WinHttpCloseHandle($hHttpOpen)

♡♡♡

.

eMyvnE

Posted (edited)

Nope, it's working fine for me. Always testing before posting. :)

Edit: But the data, lol correct trancexx.

There is an additional data there that resulting in error "Program too big to fit in memory"

rs out of order in {} quantifier CRLF..nB

Edited by Authenticity

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...