motionman95 Posted May 20, 2009 Posted May 20, 2009 Hello! Is it possible to download files without using InetGet? My client doesn't use IE.
herewasplato Posted May 20, 2009 Posted May 20, 2009 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]
ken82m Posted May 20, 2009 Posted May 20, 2009 There's a udf here to download files via http:http://www.autoitscript.com/forum/index.ph...&hl=winhttpHere's one for FTP:http://www.autoitscript.com/forum/index.ph...6403&hl=ftpThey both use windows dll's not IEThere 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."
motionman95 Posted May 20, 2009 Author Posted May 20, 2009 Awesome~! That was quick! I'll try those links and get back to you!
ken82m Posted May 20, 2009 Posted May 20, 2009 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."
motionman95 Posted May 20, 2009 Author Posted May 20, 2009 I searched the functions in the http UDF, but I couldn't find one for file download.
BrettF Posted May 21, 2009 Posted May 21, 2009 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 Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Authenticity Posted May 21, 2009 Posted May 21, 2009 #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Ø ÀÌØíͽаÁàÈÀÀÀ¤
motionman95 Posted May 21, 2009 Author Posted May 21, 2009 Thanks, authencity. That code doesn't work though...
herewasplato Posted May 21, 2009 Posted May 21, 2009 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]
trancexx Posted May 21, 2009 Posted May 21, 2009 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: expandcollapse popup#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
Authenticity Posted May 21, 2009 Posted May 21, 2009 (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 May 21, 2009 by Authenticity
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now