Jump to content

uncommon

Active Members
  • Posts

    86
  • Joined

  • Last visited

Profile Information

  • Location
    orlando

Recent Profile Visitors

478 profile views

uncommon's Achievements

Wayfarer

Wayfarer (2/7)

3

Reputation

  1. Thanks, I do remember seeing a 64bit limitation somewhere in the help file.
  2. Local $dNumber1 = Number("11044326.18126327") ; returns 11044326.1812633 ConsoleWrite($dNumber1 & @LF) Known issue or working as expected? I am running autoit 3.3.16.1
  3. So I guess the answer is just to avoid it.
  4. #AutoIt3Wrapper_run_debug_mode=Y If 1 = 1 or _;this is a comment 2 = 2 Then MsgBox(0, "", "Success") EndIf I get this... !> Starting in DebugMode.. Line: @error-@extended: Line syntax "C:\Users\eyerobot\Desktop\test_DebugIt.au3" (10) : ==> "If" statements must have a "Then" keyword.: If 1 = 1 or Dim $__errphxkieiv[2] = [@Error, @Extended] It seems like debug mode is not good with handling comments after expressions if its on more than one line. #AutoIt3Wrapper_run_debug_mode=Y $test = "Post this" _ ; my comments here & " but also this" MsgBox(0, "", $test) This also fails with a similar error. Attached find my specs.
  5. So I have been reading on how to use OAuth2 Service accounts(https://developers.google.com/identity/protocols/OAuth2ServiceAccount) and ran into an issue with autoit I can not solve. To keep this short to communicate to the Google API I need to use a JSON Web signature containing {Base64url encoded header}.{Base64url encoded claim set}. The Header and claim set work fine but I do not know how to convert them to a byte array using autoit. I have looked around on the forums and website but have not found anything that seems to work. Here is my code. #include-once #include <Array.au3> #include <Constants.au3> #include <Debug.au3> #include <File.au3> #include "Json.au3" #include <Process.au3> #include <ProgressConstants.au3> #include <String.au3> #include <WindowsConstants.au3> #include "WinHttp.au3" #include <UnixTime.au3> #include <StringConstants.au3> Global $UnixTime = _TimeGetStamp() $sJWTheader = '{"alg":"RS256","typ":"JWT"}' $sJWTclaimset = '{"iss":"Removed@forprivacy.com","scope":"https://www.googleapis.com/auth/spreadsheets","aud":"https://www.googleapis.com/oauth2/v4/token","exp":' & $UnixTime + 3600 & ',"iat":' & $UnixTime & '}' Local $taiData = DllStructCreate("BYTE[256]") Local $sText = _base64($sJWTheader)&'.'&_base64($sJWTclaimset) DllStructSetData($taiData, 1, StringToBinary($sText, 4)) Local $bvResult = DllStructGetData($taiData, 1) $sJWTSigature = $bvResult $sJWT = _base64($sJWTheader)&'.'&_base64($sJWTclaimset)&'.'&_base64($sJWTSigature) $POSTHeader = "Content-Type: application/x-www-form-urlencoded" $hOpen = _WinHttpOpen() $hConnect = _WinHttpConnect($hOpen, "https://www.googleapis.com/") $sRead = _WinHttpSimpleSSLRequest($hConnect, "POST", "oauth2/v4/token", Default, "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=" & $sJWT) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ConsoleWrite($sRead & @LF) The whole bytes thing is beyond with what I know about auotit. I can't tell what I need to fix.
  6. Not sure if anyone else ran into a problem but it seems like the _GDIPlus_EncodersGetCLSID does not seem to be working as expected. I Ran the example in the help file and got something like this. Codec GUID ............: {557CF400-1A04-11D3-9A73-0000F81EF32E} File format GUID ......: {B96B3CAB-0728-11D3-9D7B-0000F81EF32E} Codec name ............: 0x4275696C742D696E20424D5020436F64656300 Codec Dll file name ...: Codec file format .....: 0x424D5000 File name extensions ..: 0x2A2E424D503B2A2E4449423B2A2E524C4500 Mime type .............: 0x696D6167652F626D7000 Flags .................: 0x0000000000010007 Version ...............: 1 Signature count .......: 1 Signature size ........: 2 Signature pattern ptr .: 0x0317E982 Signature mask ptr ....: 0x0317E984 Parameter list size ...: 0 File name extensions should be more like (BMP, JPG, TIF, etc.) but now its in hex format. I had to change my __ScreenCapture_SaveImage function to know what $sCLSID to use and it worked after that.
  7. Well my first problem was I had and older version of WinHTTP UDF. Updated my files and then tried _WinHttpSetOption($hOpen, $WINHTTP_OPTION_SECURE_PROTOCOLS, $WINHTTP_FLAG_SECURE_PROTOCOL_ALL) Not much luck there. Then I tried _WinHttpSetOption($hOpen, $WINHTTP_OPTION_SECURE_PROTOCOLS, BitOR($WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1,$WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2)) And suddenly my WinHttp.dll came alive and it worked. Great Scott! Thank you Tranxx. You are both a lady, and a Bad**s Programmer. Did you know that? There is a great need for more people like you.
  8. Close very close. To clarify You are suggesting I use _WinHttpSetOption($hOpen, $WINHTTP_OPTION_SECURE_PROTOCOLS, $WINHTTP_FLAG_SECURE_PROTOCOL_ALL) I had to look up WINHTTP_FLAG_SECURE_PROTOCOL_ALL (The value is 84 I think) and here it is as described by Microsoft. "Sets an unsigned long integer value that specifies which secure protocols are acceptable. By default only SSL3 and TLS1 are enabled in Windows 7 and Windows 8. By default only SSL3, TLS1.0, TLS1.1, and TLS1.2 are enabled in Windows 8.1 and Windows 10. The value can be a combination of one or more of the following values." This coincides with the symptoms I have been having but when I tried it out, I still was not getting anything back from WinHTTP. I'll try some more troubleshooting, or maybe there is a way to set windows to enable TLS1.1, and TLS1.2...
  9. Thanks tranceXX I will give it a try. In the mean time I have made a windows 7 and 10 images and I am switching back and forth with I need to @__@
  10. Question about winHTTP I am encountering a Error ERROR_WINHTTP_CONNECTION_ERROR = 12030 when I connect to a certain website via SSL via _WinHttpSimpleSSLRequest. I read the documentation about this error. It states... "The connection with the server has been reset or terminated, or an incompatible SSL protocol was encountered. For example, WinHTTP version 5.1 does not support SSL2 unless the client specifically enables it." So my first thought is its a version compatibility issue, but it seems to work fine on my windows 10 computer, but not my windows 7. I made sure there were not funky router settings, windows firewall was turned off, no other firewalls. I am using the same script with the same version of autoit on both computers. I also check winhttp.dll on both computers and they are appear in the same directories with the same last date modified. Here is a small sample of my script. Local $POSTHeader, $sResponse = "{}" Local Const $AsanaAPIKey = "some hash goes here" $hOpen = _WinHttpOpen() $hConnect = _WinHttpConnect($hOpen, "http://app.asana.com/") $sRead = _WinHttpSimpleSSLRequest($hConnect, "GET", "api/1.0/projects", Default, $WINHTTP_NO_ADDITIONAL_HEADERS, "Authorization: Bearer " & $AsanaAPIKey) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) So the only variables I can think of is the OS version. My question is, am I doing this wrong or is there some kind of workaround that I am not thinking of. Thank you for your time.
  11. I think I managed to solve your problem. Sorry reviving this dead post, but I saw this and it looked like he was having the same problem when I was searching for a solution to mine.
  12. Figured it out. Use the key name in the object to get the next level object, if you do not know what will be in the next object and you need to iterate use the Keys function like this $Object.keys to return an array of the nested keys. When you get the final Parent object of the key you want to remove I used the builtin Json_ObjDelete function to remove the target key and value. The Sample code below removes the bOpts Key and value. Hopefully this helps someone in the future. Sample Code $sJsonString = FileRead(@DesktopDir & "\codebeautify.json") $oJsonString = Json_Decode($sJsonString) $oItems = $oJsonString("Game") $oParts = $oItems("Interface") $oMenu = $oParts("MainMenu") $aMenu = $oMenu.keys _ArrayDisplay($aMenu) Json_ObjDelete($oMenu, "bOpts") Sample Json { "Game":{ "Name":"Game Title Goes Here", "Interface":{ "MainMenu":{ "bOpts":"Options", "bMp":"MultiPlayer", "bSp":"SinglePlayer", "bCreds":"Credits", "bQuit":"Quit Game" } } "Input":{ "inMouse":"Mouse", "inJoy":"Joy Stick", "inKeys":"KeyBoard" } } "key2":"Key2 Text", "key3":"Key3 Text", "key4":"Key4 Text", "num":1024, "digits":{"1","2","3","4"} }
  13. That could work for this example but I need to be able to delete any part of if. There might be some 'foo' I want to remove and some I want to keep. I am starting to think it might be a easier to use autoit as a wrapping in another language.
  14. So I started using Json.au3 (2015.01.08) by Ward. Pretty good but I am having some real trouble figuring out how to remove a certain key. There is an internal function called Json_ObjDelete which seems to use a Scripting.Dictionary Object this uses $Object.Remove($Key) but this will only remove the first level key. For example if I use $Object.Remove('foo') in a json string like this... {"foo":"foo","bar":["bar"],"test":["",{"foo":{"bar":["","",{"foo":{"bar":"Test"}}]}}]} It will reduce do this... {"bar":["bar"],"test":["",{"foo":{"bar":["","",{"foo":{"bar":"Test"}}]}}]} So my question is how do I get to the next 'foo' and remove it because it does not seem to recognize others as a key? Thank you for your time.
  15. Oh! now I see it was crashing because it would try and move to the next iteration and there would not be one. I for in iteration would "Know" or do some kind of internal check to find the length. Makes sense now, thanks for fixing my problem.
×
×
  • Create New...