;@jugador ; #FUNCTION# ============================================================================= ; Name...........: __JsonObjCreate ; ======================================================================================== Func __JsonObjCreate(ByRef $Object) Local $oError = ObjEvent("AutoIt.Error", "_ErrorHandler") #forceref $oError $Object = ObjCreate("ScriptControl") If Not IsObj($Object) Then Return SetError(1, 0, '@error: failed to create ScriptControl Object') $Object.Language = "JScript" $Object.AddCode(__Javascript_Json2()) $Object.Eval("function JSONParse(str){ if (typeof str !== 'string') return '@error: not String'; " & _ "try { var result = JSON.parse(str); var type = Object.prototype.toString.call(result); " & _ "if (type === '[object Object]' || type === '[object Array]') { return result; } " & _ "else { return '@error: not Json'; } } catch (err) { return '@error: error while Parsing'; } };") $Object.Eval("if (typeof Array.isArray === 'undefined') { Array.isArray = function(obj) " & _ "{ return Object.prototype.toString.call(obj) === '[object Array]';}};") $Object.Eval("Object.prototype.stringify=function( a, b ) { return JSON.stringify(this, a, b) } ;") $Object.Eval("Object.prototype.GetValueByKey=function(a, i){return a[i]} ;") $Object.Eval("Object.prototype.NewObject=function(a, i){a[i] = {}; return a[i]} ;") $Object.Eval("Object.prototype.NewArray=function(a, i){a[i] = []; return a[i]} ;") $Object.Eval("Object.prototype.AddByKey=function(a, i, value){a[i] = value} ;") $Object.Eval("Object.prototype.EditByKey=function(a, i, value){a[i] = value} ;") $Object.Eval("Object.prototype.DeleteByKey=function(a, i){if (Array.isArray(a)) {a.splice(i,1);} else {delete a[i];}} ;") EndFunc ;==>Json_ObjCreate ; #FUNCTION# ============================================================================= ; Name...........: __JsonParse ; ======================================================================================== Func __JsonParse($o_Obj, $o_JsString) If Not IsString($o_JsString) Then Return SetError(2, 0, "@error: It's not a String it's a " & VarGetType($o_JsString)) Local $o_Parse = $o_Obj.Eval("JSONParse('"& $o_JsString &"')") If Not IsObj($o_Parse) Then Return SetError(1, 0, $o_Parse) Return $o_Parse EndFunc ;==> ; #FUNCTION# ============================================================================= ; Name...........: __AddElement ; ======================================================================================== Func __AddElement($o_RObj, $o_key, $o_Value) If ObjName($o_RObj, 1) = 'JScript Type Info' Then Return SetError(1) If Not IsObj($o_RObj) Then Return SetError(2) $o_RObj.AddByKey($o_RObj, $o_key, $o_Value) EndFunc ;==> ; #FUNCTION# ============================================================================= ; Name...........: __EditElement ; ======================================================================================== Func __EditElement($o_RObj, $o_key, $o_Value) If ObjName($o_RObj, 1) = 'JScript Type Info' Then Return SetError(1) If Not IsObj($o_RObj) Then Return SetError(2) $o_RObj.EditByKey($o_RObj, $o_key, $o_Value) EndFunc ;==> ; #FUNCTION# ============================================================================= ; Name...........: __DeleteElement ; ======================================================================================== Func __DeleteElement($o_RObj, $o_key) If ObjName($o_RObj, 1) = 'JScript Type Info' Then Return SetError(1) If Not IsObj($o_RObj) Then Return SetError(2) $o_RObj.DeleteByKey($o_RObj, $o_key) EndFunc ;==> ; #FUNCTION# ============================================================================= ; Name...........: __GetElement ; ======================================================================================== Func __GetElement($o_RObj, $o_key) If ObjName($o_RObj, 1) = 'JScript Type Info' Then Return SetError(1, 0, '@error: Not a JavaScript Object') If Not IsObj($o_RObj) Then Return SetError(2, 0, "@error: It's not an Object it's a " & VarGetType($o_RObj)) Return $o_RObj.GetValueByKey($o_RObj, $o_key) EndFunc ;==> ; #FUNCTION# ============================================================================= ; Name...........: __CreateNewObject ; ======================================================================================== Func __InitiateNewObject($o_RObj, $o_key) If ObjName($o_RObj, 1) = 'JScript Type Info' Then Return SetError(1, 0, '@error: Not a JavaScript Object') If Not IsObj($o_RObj) Then Return SetError(2, 0, "@error: It's not an Object it's a " & VarGetType($o_RObj)) Return $o_RObj.NewObject($o_RObj, $o_key) EndFunc ;==> ; #FUNCTION# ============================================================================= ; Name...........: __CreateNewObject ; ======================================================================================== Func __InitiateNewArray($o_RObj, $o_key) If ObjName($o_RObj, 1) = 'JScript Type Info' Then Return SetError(1, 0, '@error: Not a JavaScript Object') If Not IsObj($o_RObj) Then Return SetError(2, 0, "@error: It's not an Object it's a " & VarGetType($o_RObj)) Return $o_RObj.NewArray($o_RObj, $o_key) EndFunc ;==> ; #FUNCTION# ============================================================================= ; Name...........: __Json_PRETTY_PRINT ; ======================================================================================== Func __Json_PRETTY_PRINT($o_RObj, $o_paramA = Null, $o_paramB = @TAB) If ObjName($o_RObj, 1) = 'JScript Type Info' Then Return SetError(1, 0, '@error: Not a JavaScript Object') If Not IsObj($o_RObj) Then Return SetError(2, 0, "@error: It's not an Object it's a " & VarGetType($o_RObj)) Return $o_RObj.stringify($o_paramA, $o_paramB) EndFunc ;==> ; #FUNCTION# ============================================================================= ; Name...........: __Javascript_Json2 ; Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2015-01-20 ; https://github.com/douglascrockford/JSON-js/blob/master/json2.js ; https://www.autoitscript.com/forum/topic/206576-wd_capabilitiesau3-support-topic-early-beta-version-work-in-progress/?do=findComment&comment=1488760 ; ======================================================================================== Func __Javascript_Json2() Local $_Json2_MinJS $_Json2_MinJS &= 'Ly8gIGpzb24yLmpzCi8vICAyMDE3LTA2LTEyCi8vICBQdWJsaWMgRG9tYWluLgovLyAgTk8gV0FSUkFOVFkgRVhQUkVTU0VEIE9SIElNUExJRUQuIFVTRSBBVCBZT1VSIE9XTiBSSVNLLgoKLy8gIFVTRSBZT1VSIE9XTiBDT1BZLiBJVCBJUyBFWFRSRU1FTFkgVU5XSVNFIFRPIExPQUQgQ09ERSBGUk9NIFNFUlZFUlMgWU9VIERPCi8vICBOT1QgQ09OVFJPTC4KCi8vICBUaGlzIGZpbGUgY3JlYXRlcyBhIGdsb2JhbCBKU09OIG9iamVjdCBjb250YWluaW5nIHR3byBtZXRob2RzOiBzdHJpbmdpZnkKLy8gIGFuZCBwYXJzZS4gVGhpcyBmaWxlIHByb3ZpZGVzIHRoZSBFUzUgSlNPTiBjYXBhYmlsaXR5IHRvIEVTMyBzeXN0ZW1zLgovLyAgSWYgYSBwcm9qZWN0IG1pZ2h0IHJ1biBvbiBJRTggb3IgZWFybGllciwgdGhlbiB0aGlzIGZpbGUgc2hvdWxkIGJlIGluY2x1ZGVk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ICAgICAgICAgICAgIHJldHVybiAobiA8IDEwKQovLyAgICAgICAgICAgICAgICAgICAgICAgICAgPyAiMCIgKyBuCi8vICAgICAgICAgICAgICAgICAgICAgICAgICA6IG47Ci8vICAgICAgICAgICAgICAgICAgfQovLyAgICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmdldFVUQ0Z1bGxZZWFyKCkgICArICItIiArCi8vICAgICAgICAgICAgICAgICAgICAgICBmKHRoaXMuZ2V0VVRDTW9udGgoKSArIDEpICsgIi0iICsKLy8gICAgICAgICAgICAgICAgICAgICAgIGYodGhpcy5nZXRVVENEYXRlKCkpICAgICAgKyAiVCIgKwovLyAgICAgICAgICAgICAgICAgICAgICAgZih0aGlzLmdldFVUQ0hvdXJzKCkpICAgICArICI6IiArCi8vICAgICAgICAgICAgICAgICAgICAgICBmKHRoaXMuZ2V0VVRDTWludXRlcygpKSAgICsgIjoiICsKLy8gICAgICAgICAgICAgICAgICAgICAgIGYodGhpcy5nZXRVVENTZWNvbmRzKCkpICAgKyAiWiI7Ci8vICAgICAgICAgICAgICB9OwoKLy8gICAgICAgICAgWW91IGNhbiBwcm92aWRlIGFuIG9wdGlvbmFsIHJlcGxhY2VyIG1ldGhvZC4gSXQgd2lsbCBiZSBwYXNzZWQgdGhlCi8vICAgICAgICAgIGtleSBhbmQgdmFsdWUgb2YgZWFjaCBtZW1iZXIsIHdpdGggdGhpcyBib3VuZCB0byB0aGUgY29udGFpbmluZwovLyAgICAgICAgICBvYmplY3QuIFRoZSB2YWx1ZSB0aGF0IGlzIHJldHVybmVkIGZyb20geW91ciBtZXRob2Qgd2lsbCBiZQovLyAgICAgICAgICBzZXJpYWxpemVkLiBJZiB5b3VyIG1ldGhvZCByZXR1cm5zIHVuZGVmaW5lZCwgdGhlbiB0aGUgbWVtYmVyIHdpbGwKLy8gICAgICAgICAgYmUgZXhjbHVkZWQgZnJvbSB0aGUgc2VyaWFsaXphdGlvbi4KCi8vICAgICAgICAgIElmIHRoZSByZXBsYWNl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1ZSk7Ci8vICAgICAgICAgICAgICAgICAgaWYgKGEpIHsKLy8gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBEYXRlKERhdGUuVVRDKAovLyAgICAgICAgICAgICAgICAgICAgICAgICArYVsxXSwgK2FbMl0gLSAxLCArYVszXSwgK2FbNF0sICthWzVdLCArYVs2XQovLyAgICAgICAgICAgICAgICAgICAgICApKTsKLy8gICAgICAgICAgICAgICAgICB9Ci8vICAgICAgICAgICAgICAgICAgcmV0dXJuIHZhbHVlOwovLyAgICAgICAgICAgICAgfQovLyAgICAgICAgICB9KTsKCi8vICAgICAgICAgIG15RGF0YSA9IEpTT04ucGFyc2UoCi8vICAgICAgICAgICAgICAiW1wiRGF0ZSgwOS8wOS8yMDAxKVwiXSIsCi8vICAgICAgICAgICAgICBmdW5jdGlvbiAoa2V5LCB2YWx1ZSkgewovLyAgICAgICAgICAgICAgICAgIHZhciBkOwovLyAgICAgICAgICAgICAgICAgIGlmICgKLy8gICAgICAgICAgICAgICAgICAgICAgdHlwZW9mIHZhbHVlID09PSAic3RyaW5nIgovLyAgICAgICAgICAgICAgICAgICAgICAmJiB2YWx1ZS5zbGljZSgwLCA1KSA9PT0gIkRhdGUoIgovLyAgICAgICAgICAgICAgICAgICAgICAmJiB2YWx1ZS5zbGljZSgtMSkg' $_Json2_MinJS &= 'PT09ICIpIgovLyAgICAgICAgICAgICAgICAgICkgewovLyAgICAgICAgICAgICAgICAgICAgICBkID0gbmV3IERhdGUodmFsdWUuc2xpY2UoNSwgLTEpKTsKLy8gICAgICAgICAgICAgICAgICAgICAgaWYgKGQpIHsKLy8gICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBkOwovLyAgICAgICAgICAgICAgICAgICAgICB9Ci8vICAgICAgICAgICAgICAgICAgfQovLyAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTsKLy8gICAgICAgICAgICAgIH0KLy8gICAgICAgICAgKTsKCi8vICBUaGlzIGlzIGEgcmVmZXJ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ICAgICAgICAgICAgICAgICAgKyBmKHRoaXMuZ2V0VVRDRGF0ZSgpKQogICAgICAgICAgICAgICAgICAgICsgIlQiCiAgICAgICAgICAgICAgICAgICAgKyBmKHRoaXMuZ2V0VVRDSG91cnMoKSkKICAgICAgICAgICAgICAgICAgICArICI6IgogICAgICAgICAgICAgICAgICAgICsgZih0aGlzLmdldFVUQ01pbnV0ZXMoKSkKICAgICAgICAgICAgICAgICAgICArICI6IgogICAgICAgICAgICAgICAgICAgICsgZih0aGlzLmdldFVUQ1NlY29uZHMoKSkKICAgICAgICAgICAgICAgICAgICArICJaIgogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgOiBudWxsOwogICAgICAgIH07CgogICAgICAgIEJvb2xlYW4ucHJvdG90eXBlLnRvSlNPTiA9IHRoaXNfdmFsdWU7CiAgICAgICAgTnVtYmVyLnByb3RvdHlwZS50b0pTT04gPSB0aGlzX3ZhbHVlOwogICAgICAgIFN0cmluZy5wcm90b3R5cGUudG9KU09OID0gdGhpc192YWx1ZTsKICAgIH0KCiAgICB2YXIgZ2FwOwogICAgdmFyIGluZGVudDsKICAgIHZhciBtZXRhOwogICAgdmFyIHJlcDsKCgogICAgZnVuY3Rpb24gcXVvdGUoc3RyaW5nKSB7CgovLyBJZiB0aGUgc3RyaW5nIGNvbnRhaW5zIG5vIGNvbnRyb2wgY2hhcmFjdGVycywgbm8gcXVvdGUgY2hhcmFjdGVycywgYW5kIG5vCi8vIGJhY2tzbGFzaCBjaGFyYWN0ZXJzLCB0aGVuIHdlIGNhbiBzYWZlbHkgc2xhcCBzb21lIHF1b3RlcyBhcm91bmQgaXQuCi8vIE90aGVyd2lzZSB3ZSBtdXN0IGFsc28gcmVwbGFjZSB0aGUgb2ZmZW5kaW5nIGNoYXJhY3RlcnMgd2l0aCBzYWZlIGVzY2FwZQovLyBzZXF1ZW5jZXMuCgogICAgICAgIHJ4X2VzY2FwYWJsZS5sYXN0SW5kZXggPSAwOwogICAgICAgIHJldHVybiByeF9lc2NhcGFibGUudGVzdChzdHJpbmcpCiAgICAgICAgICAgID8gIlwiIiArIHN0cmluZy5yZXBsYWNlKHJ4X2VzY2FwYWJsZSwgZnVuY3Rpb24gKGEpIHsKICAgICAgICAgICAgICAgIHZhciBjID0gbWV0YVthXTsKICAgICAgICAgICAgICAgIHJldHVybiB0eXBlb2YgYyA9PT0gInN0cmluZyIKICAgICAgICAgICAgICAgICAgICA/IGMKICAgICAgICAgICAgICAgICAgICA6ICJcXHUi' $_Json2_MinJS &= 'ICsgKCIwMDAwIiArIGEuY2hhckNvZGVBdCgwKS50b1N0cmluZygxNikpLnNsaWNlKC00KTsKICAgICAgICAgICAgfSkgKyAiXCIiCiAgICAgICAgICAgIDogIlwiIiArIHN0cmluZyArICJcIiI7CiAgICB9CgoKICAgIGZ1bmN0aW9uIHN0cihrZXksIGhvbGRlcikgewoKLy8gUHJvZHVjZSBhIHN0cmluZyBmcm9tIGhvbGRlcltrZXldLgoKICAgICAgICB2YXIgaTsgICAgICAgICAgLy8gVGhlIGxvb3AgY291bnRlci4KICAgICAgICB2YXIgazsgICAgICAgICAgLy8gVGhlIG1lbWJlciBrZXkuCiAgICAgICAgdmFyIHY7ICAgICAgICAgIC8vIFRoZSBtZW1iZXIgdmFsdWUuCiAgICAgICAgdmFyIGxlbmd0aDsKICAgICAgICB2YXIgbWluZCA9IGdhcDsKICAgICAgICB2YXIgcGFydGlhbDsKICAgICAgICB2YXIgdmFsdWUgPSBob2xkZXJba2V5XTsKCi8vIElmIHRoZSB2YWx1ZSBoYXMgYSB0b0pTT04gbWV0aG9kLCBjYWxsIGl0IHRvIG9idGFpbiBhIHJlcGxhY2VtZW50IHZhbHVlLgoKICAgICAgICBpZiAoCiAgICAgICAgICAgIHZhbHVlCiAgICAgICAgICAgICYmIHR5cGVvZiB2YWx1ZSA9PT0gIm9iamVjdCIKICAgICAgICAgICAgJiYgdHlwZW9mIHZhbHVlLnRvSlNPTiA9PT0gImZ1bmN0aW9uIgogICAgICA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vIEpvaW4gYWxsIG9mIHRoZSBlbGVtZW50cyB0b2dldGhlciwgc2VwYXJhdGVkIHdpdGggY29tbWFzLCBhbmQgd3JhcCB0aGVtIGluCi8vIGJyYWNrZXRzLgoKICAgICAgICAgICAgICAgIHYgPSBwYXJ0aWFsLmxlbmd0aCA9PT0gMAogICAgICAgICAgICAgICAgICAgID8gIltdIgogICAgICAgICAgICAgICAgICAgIDogZ2FwCiAgICAgICAgICAgICAgICAgICAgICAgID8gKAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIltcbiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgZ2FwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICArIHBhcnRpYWwuam9pbigiLFxuIiArIGdhcCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICsgIlxuIgogICAgICAgICAgICAgICAgICAgICAgICAgICAgKyBtaW5kCiAgICAgICAgICAgICAgICAgICAgICAgICAgICArICJdIgogICAgICAgICAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAgICAgICAgIDogIlsiICsgcGFydGlhbC5qb2luKCIsIikgKyAiXSI7CiAgICAgICAgICAgICAgICBnYXAgPSBtaW5kOwogICAgICAgICAgICAgICAgcmV0dXJuIHY7CiAgICAgICAgICAgIH0KCi8vIElmIHRoZSByZXBsYWNlciBpcyBhbiBhcnJheSwgdXNlIGl0IHRvIHNlbGVjdCB0aGUgbWVtYmVycyB0byBiZSBzdHJpbmdpZmllZC4KCiAgICAgICAgICAgIGlmIChyZXAgJiYgdHlwZW9mIHJlcCA9' $_Json2_MinJS &= 'PT0gIm9iamVjdCIpIHsKICAgICAgICAgICAgICAgIGxlbmd0aCA9IHJlcC5sZW5ndGg7CiAgICAgICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuZ3RoOyBpICs9IDEpIHsKICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIHJlcFtpXSA9PT0gInN0cmluZyIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgayA9IHJlcFtpXTsKICAgICAgICAgICAgICAgICAgICAgICAgdiA9IHN0cihrLCB2YWx1ZSk7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmICh2KSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXJ0aWFsLnB1c2gocXVvdGUoaykgKyAoCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKGdhcCkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPyAiOiAiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDogIjoiCiAgICAgICAgICAgICAgICAgICAgICAgICAgICApICsgdik7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0gZWxzZSB7CgovLyBPdGhlcndpc2UsIGl0ZXJhdGUgdGhyb3VnaCBhbGwgb2YgdGhlIGtleXMgaW4gdGhlIG9iamVjdC4KCiAgICAgICAgICAgICAgICBmb3IgKGsgaW4gdmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICB2ID0gc3RyKGssIHZhbHVlKTsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBhcnRpYWwucHVzaChxdW90ZShrKSArICgKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoZ2FwKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA/ICI6ICIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiAiOiIKICAgICAgICAgICAgICAgICAgICAgICAgICAgICkgKyB2KTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQoKLy8gSm9pbiBhbGwgb2YgdGhlIG1lbWJlciB0ZXh0cyB0b2dldGhlciwgc2VwYXJhdGVkIHdpdGggY29tbWFzLAovLyBhbmQgd3JhcCB0aGVtIGluIGJyYWNlcy4KCiAgICAgICAgICAgIHYgPSBwYXJ0aWFsLmxlbmd0aCA9PT0gMAogICAgICAgICAgICAgICAgPyAie30iCiAgICAgICAgICAgICAgICA6IGdhcAogICAgICAgICAgICAgICAgICAgID8gIntcbiIgKyBnYXAgKyBwYXJ0aWFsLmpvaW4oIixcbiIgKyBnYXApICsgIlxuIiArIG1pbmQgKyAifSIKICAgICAgICAgICAgICAgICAgICA6ICJ7IiArIHBhcnRpYWwuam9pbigiLCIpICsgIn0iOwogICAgICAgICAgICBnYXAgPSBtaW5kOwogICAgICAgICAgICByZXR1cm4gdjsKICAgICAgICB9CiAgICB9CgovLyBJZiB0aGUgSlNPTiBv' $_Json2_MinJS &= 'YmplY3QgZG9lcyBub3QgeWV0IGhhdmUgYSBzdHJpbmdpZnkgbWV0aG9kLCBnaXZlIGl0IG9uZS4KCiAgICBpZiAodHlwZW9mIEpTT04uc3RyaW5naWZ5ICE9PSAiZnVuY3Rpb24iKSB7CiAgICAgICAgbWV0YSA9IHsgICAgLy8gdGFibGUgb2YgY2hhcmFjdGVyIHN1YnN0aXR1dGlvbnMKICAgICAgICAgICAgIlxiIjogIlxcYiIsCiAgICAgICAgICAgICJcdCI6ICJcXHQiLAogICAgICAgICAgICAiXG4iOiAiXFxuIiwKICAgICAgICAgICAgIlxmIjogIlxcZiIsCiAgICAgICAgICAgICJcciI6ICJcXHIiLAogICAgICAgICAgICAiXCIiOiAiXFxcIiIsCiAgICAgICAgICAgICJcXCI6ICJcXFxcIgogICAgICAgIH07CiAgICAgICAgSlNPTi5zdHJpbmdpZnkgPSBmdW5jdGlvbiAodmFsdWUsIHJlcGxhY2VyLCBzcGFjZSkgewoKLy8gVGhlIHN0cmluZ2lmeSBtZXRob2QgdGFrZXMgYSB2YW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zIGEgdmFsaWQgSlNPTiB0ZXh0LgoKICAgICAgICAgICAgdmFyIGo7CgogICAgICAgICAgICBmdW5jdGlvbiB3YWxrKGhvbGRlciwga2V5KSB7CgovLyBUaGUgd2FsayBtZXRob2QgaXMgdXNlZCB0byByZWN1cnNpdmVseSB3YWxrIHRoZSByZXN1bHRpbmcgc3RydWN0dXJlIHNvCi8vIHRoYXQgbW9kaWZpY2F0aW9ucyBjYW4gYmUgbWFkZS4KCiAgICAgICAgICAgICAgICB2YXIgazsKICAgICAgICAgICAgICAgIHZhciB2OwogICAgICAgICAgICAgICAgdmFyIHZhbHVlID0gaG9sZGVyW2tleV07CiAgICAgICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAib2JqZWN0IikgewogICAgICAgICAgICAgICAgICAgIGZvciAoayBpbiB2YWx1ZSkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoT2JqZWN0LnByb3RvdHlwZS5oYXNPd25Qcm9wZXJ0eS5jYWxsKHZhbHVlLCBrKSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdiA9IHdhbGsodmFsdWUsIGspOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHYgIT09IHVuZGVmaW5lZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlW2tdID0gdjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGVsZXRlIHZhbHVlW2tdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgcmV0dXJuIHJldml2ZXIuY2FsbChob2xkZXIsIGtleSwgdmFsdWUpOwogICAgICAgICAgICB9CgoKLy8gUGFyc2luZyBoYXBwZW5zIGluIGZvdXIgc3RhZ2VzLiBJbiB0aG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AgICAgICAgKQogICAgICAgICAgICApIHsKCi8vIEluIHRoZSB0aGlyZCBzdGFnZSB3ZSB1c2UgdGhlIGV2YWwgZnVuY3Rpb24gdG8gY29tcGlsZSB0aGUgdGV4dCBpbnRvIGEKLy8gSmF2YVNjcmlwdCBzdHJ1Y3R1cmUuIFRoZSAieyIgb3BlcmF0b3IgaXMgc3ViamVjdCB0byBhIHN5bnRhY3RpYyBhbWJpZ3VpdHkKLy8gaW4gSmF2YVNjcmlwdDogaXQgY2FuIGJlZ2luIGEgYmxvY2sgb3IgYW4gb2JqZWN0IGxpdGVyYWwuIFdlIHdyYXAgdGhlIHRleHQKLy8gaW4gcGFyZW5zIHRvIGVsaW1pbmF0ZSB0aGUgYW1iaWd1aXR5LgoKICAgICAgICAgICAgICAgIGogPSBldmFsKCIoIiArIHRleHQgKyAiKSIpOwoKLy8gSW4gdGhlIG9wdGlvbmFsIGZvdXJ0aCBzdGFnZSwgd2UgcmVjdXJzaXZlbHkgd2FsayB0aGUgbmV3IHN0cnVjdHVyZSwgcGFzc2luZwovLyBlYWNoIG5hbWUvdmFsdWUgcGFpciB0byBhIHJldml2ZXIgZnVuY3Rpb24gZm9yIHBvc3NpYmxlIHRyYW5zZm9ybWF0aW9uLgoKICAgICAgICAgICAgICAgIHJldHVybiAodHlwZW9mIHJldml2ZXIgPT09ICJmdW5jdGlvbiIpCiAgICAgICAgICAgICAgICAgICAgPyB3YWxrKHsiIjogan0sICIiKQogICAgICAgICAgICAgICAgICAgIDogajsKICAgICAgICAgICAgfQoKLy8gSWYgdGhlIHRleHQgaXMgbm90IEpTT04gcGFyc2VhYmxlLCB0aGVuIGEgU3ludGF4RXJyb3IgaXMgdGhyb3duLgoKICAgICAgICAgICAgdGhyb3cgbmV3IFN5bnRheEVycm9yKCJKU09OLnBhcnNlIik7CiAgICAgICAgfTsKICAgIH0KfSgpKTsK' Local Const $bString = Binary(_WinAPI_Base64Decode($_Json2_MinJS)) Return BinaryToString($bString) EndFunc ;==>__Javascript_Json2 ; #FUNCTION# ============================================================================= ; Name...........: _WinAPI_Base64Decode ; https://www.autoitscript.com/forum/topic/206576-wd_capabilitiesau3-support-topic-early-beta-version-work-in-progress/?do=findComment&comment=1488760 ; ======================================================================================== Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode ;#forceref $oError ; #FUNCTION# ============================================================================= ; Name...........: _ErrorHandler ; ======================================================================================== Func _ErrorHandler() EndFunc ;==>_ErrorHandler