Jump to content

toby9999

Members
  • Posts

    16
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

toby9999's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks folks, I've downloaded WinMerge and will give it a try
  2. Ahh, so I should use SciTE for my normal editing but use WinMerge for comparing scripts against each?
  3. I couldn't find any reference in the help files to allow this. I would like to split the SciTE editor window so that I can view and compare two scripts at the same time, side by side. Is there a way to do this in SciTE? Thanks.
  4. That's great ... exactly the example I was looking for. I also like the With/EndWith - much neater that way!
  5. That's great, it's working now. I had been working on the incorrect assumption that I needed to pass the full string as the header as a SINGLE PARAMETER, including the double quotes and the comma. Whereas your syntax passes TWO parameters to the header. Thanks so much for your assistance ... I'd probably have been stuck for days searching for an answer otherwise. Regarding error checking, I do have some basic error checking in the rest of my code (the code I posted here was just an extract of the problem section). Having said that, I'm actually not sure how to do error checking for the HTTP code because it's calling a COM object, so I can't use AutoIT commands like @error. If you don't mind, could you please point me to some documentation or a script example for that? I very much do want to add some HTTP/COM error checking if possible. P.S. I snuck a look at your HTTP Server function, and you've given me some good ideas for formatting my code more neatly (I'm very much a noob with AutoIT). Cheers
  6. I've added comments in the code I posted.
  7. #include <MsgBoxConstants.au3> Local $sOut = "" Local $sAuthString = "" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "https://slack.com/api/chat.postMessage", False) $oHTTP.SetRequestHeader("Content-Type", "application/json; charset=utf-8") ; OPTION 1: call SetRequestHeader with auth string directly - this works correctly with (a) Running within SCiTE (F5) and (b) Running from cmd prompt (both .exe and "autoit3.exe test.au3") $oHTTP.SetRequestHeader("Authorization", "Bearer xoxb-<obfuscated>") ; OPTION 2: call SetRequestHeader with auth string in a string variable - this works correctly with (a) Running within SCiTE (F5), BUT DOES NOT WORK with (b) Running from cmd prompt (both .exe and "autoit3.exe test.au3") ; When option 2 fails (at the $oHTTP.SetRequestHeader command), the error is "The requested action with this object failed" (see attached image) $sAuthString = '"Authorization", "Bearer xoxb-<obfuscated>"' $oHTTP.SetRequestHeader($sAuthString) $sOut = '{"channel":"#script-notifications", "text":"Test message", "icon_emoji":":information_source:"}' $oHTTP.Send($sOut) $sStatusCode = $oHTTP.Status $sResponse = $oHTTP.ResponseText MsgBox($MB_OK,"", "SlackOut: " & @CR & $sOut) MsgBox($MB_OK,"", "SlackStatus: " & @CR & $sStatusCode) MsgBox($MB_OK,"", "SlackResponse: " & @CR & $sResponse) Will do. I'll add the extra COM error capturing code and get back to you with the results. Thanks.
  8. Will do. I'll add the extra COM error capturing code and get back to you with the results. Thanks.
  9. Yes, still failing unfortunately. Is there any advanced logging or something I can enable to capture for info maybe?
  10. I've just tried all the "run as admin" options but the problem stills persists unfortunately.
  11. Hi I've hit a strange issue when doing a HTTP POST call using the WinHTTP COM object in Windows 10. When I run a script in SCITE (pressing F5 - Run), my script works. When I run a script with "autoit3.exe myscript.au3" on the windows cmd prompt, it doesn't work - the WinHTTP COM object throws an error stating "the requested action with this object has failed". However, it gets weird... If I call $oHTTP.SetRequestHeader("Authorization", "Bearer xoxb-..."), ie with the string directly in the call, it works in both cases. If I call $sAuthString = '"Authorization", "Bearer xoxb-..."' (FYI for clarity in this posting, that's a pair of single quotes surrounding the string), followed by... $oHTTP.SetRequestHeader($sAuthString), ie with the string in a variable, it only works in SCITE, *not* on the command line. When I MsgBox both versions (direct string vs string variable), it shows both strings looking identical as far as I can tell. So it seems like, when calling from the command line, the $sAuthString... assignment is somehow mangling the string?? I'm fairly new to AutoIT, so maybe there's something special I need to setup? TIA
  12. Thx for the replies folks!
  13. I have a compiled autoit3 .exe Is there a command in autoit3 so I can tell where the .exe is running from (ie which directory is the .exe located in)? Thx.
  14. Hello I recently posted asking about the _WinHttpSetDefaultProxyConfiguration function. I didn't receive any replies, so I assume no one knows the answer. But just in case I wasn't clear in my question, I thought I'd try again with a related question... (sorry to be kinda posting twice) Can someone please tell me what the acceptable/correct parameters are for the _WinHttpSetDefaultProxyConfiguration function, as I keep getting the error: "The parameter is incorrect." Thanks.
×
×
  • Create New...