Sign in to follow this  
Followers 0
motionman95

Download files without using InetGet?

12 posts in this topic

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


Share this post


Link to post
Share on other sites



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]

Share this post


Link to post
Share on other sites

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


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
Share on other sites

Awesome~! That was quick! I'll try those links and get back to you! :)


Share this post


Link to post
Share on other sites

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.


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "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."

Share this post


Link to post
Share on other sites

I searched the functions in the http UDF, but I couldn't find one for file download.


Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

#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Ø ÀÌØíͽ­Ð°ÁàÈÀÀÀ¤

Share this post


Link to post
Share on other sites

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


Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#12 ·  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

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