Jump to content
Sign in to follow this  
webxt

What changed is the latest versions of Autoit?

Recommended Posts

webxt

Hi,

Just after updated Autoit to the latest version (the older version was around one year old), things like the following stopped working.

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://example.com/s.php", True)
$sPD = ""
$oHTTP.Send($sPD)
MsgBox(4096, 'return', $oHTTP.Status)
Exit

It doesn't give any errors, it just doesn't return anything.

Any help?

Share this post


Link to post
Share on other sites
water

"What changed?" - Please check the history. There is a section about script breaking changes as well.

There is absolutely no error checking in your script.

Make sure that no function call returns an error before executing the next statement.

$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
If @error Then Exit MsgBox(0, "Error", "ObjCreate: Error occurred: @error = " & @error)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
jchd

BTW it seems that a simple If @error Then is going to stop working in the near future (sigh!).


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
webxt

Thank your for the fast reply, I should have checked before posting.

Seems that replacing True with False on $oHTTP.Open (async) returns the correct 200 status.

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  

  • Similar Content

    • Luigi
      By Luigi
      Greetings,
      I want use WinHttpRequest to access a OpenShift API server, it use a self signed certificate.
      Does now work...
      I never try with a self signed certificate, how do this?
      Best regards
      Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", "https://openshift.domain:1234/api/", False) $oHttp.Option(4) = 0x0100 + 0x0200 + 0x1000 + 0x2000 $oHTTP.Option(9) = 0x0080 ;WinHttpRequestOption_SecureProtocols ;~ $oHttp.SetClientCertificate("LOCAL_MACHINE\\Personal\\certificado.crt") $oHttp.Send() $oHttp.WaitForResponse() Local $oAllHeaders = $oHttp.GetAllResponseHeaders() $oReceived = $oHttp.ResponseText $oStatusCode = $oHttp.Status $oHttp = 0 If $oStatusCode = 200 Then ConsoleWrite("$oAllHeaders--------------------" & @LF & $oAllHeaders & "$oAllHeaders--------------------" & @LF) Else ConsoleWrite("< error = " & $oReceived & @LF & $oAllHeaders & @LF) EndIf  
    • Rampantshadow
      By Rampantshadow
      Hi Guys,
      I am having an issue with multiple Windows 10 systems (actually all systems running Windows 10 running the same script have this issue) I have a script which calls the winhttp.winhttprequest.5.1 object and allows me to get sites HTML source, I am using multiple Open commands on the same object which I didn't assume would be an issue.
      The issue I am getting is quite often the Send command to the object will fail (in fact I have not been able to finish running the script because it fails everytime) with an Error
      Now this exact code was working fine in Windows 8/8.1 and Windows 7 before I upgraded the systems to Windows 10, anybody know what's going on here?
      P.S when I say I use multiple Open and Send commands I mean I have two instances of winhttprequest objects open and it probably does a total of about 600 Open and Sends but as I mentioned this had never been an issue until Windows 10.
    • MvGulik
      By MvGulik
      Not familiar with "winhttp.winhttprequest.5.1" Object, Ergo: Just experimenting a bit with it.
      When using the 'ResponseStream' option ... AutoIt crashes.

      - Anything I'm doing wrong (or missed) ? (or potential issue/bug)

      Don't know much about a 'IStream', other than that 'ResponseStream' is supposed to return a pointer to it.

      msdn: WinHttpRequest Object


      main() Func main() Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") Local $sType = 'GET' Local $sUrl = 'http://www.autoitscript.com/site/' Local $sData = '' ;; optional parm. _HTTPRequest($oHTTP, $sType, $sUrl, $sData) EndFunc Func _HTTPRequest($oHTTP, $oMethod, $oURL, $oData = "") ;; http://msdn.microsoft.com/en-us/library/aa384106 Local $iResult = 0 ;; debug $oHTTP.Open($oMethod, $oURL, False) ;; empty -> ok. $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5") ;; empty -> ok. If $oMethod = "POST" Then $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") ;; empty -> ok. EndIf $oHTTP.Send($oData) ;; empty -> ok. ;~ ;; options: ResponseBody, ResponseStream, ResponseText, Status, StatusText ;~ $iResult = $oHTTP.StatusText ;; "OK" -> ok. ;~ $iResult = $oHTTP.Status ;; 200 -> ok. ;~ $iResult = $oHTTP.ResponseBody ;; binary(ResponseText) -> ok. ;~ $iResult = $oHTTP.ResponseText ;; html page/content -> ok. $iResult = $oHTTP.ResponseStream ;; crash with 3.3.6.1 & 3.3.7.14 (Win.Xp.32b) EndFunc
×