Leaderboard
Popular Content
Showing content with the highest reputation on 10/04/2022 in all areas
-
Xml2Json UDF - Transform XML to JSON
AspirinJunkie reacted to TheXman for a topic
The tools & UDF's used to parse and process JSON are much more flexible and powerful than the ones for XML. In general, they are also much faster. So I created this Xml2Json UDF to tranform XML to JSON. It consists of 2 functions, _Xml2Json() and _XmlFile2Json(). ;================================================================================================= ; _Xml2Json($sXml, $sXsl = Default) ; ; Author: TheXman (https://www.autoitscript.com/forum/profile/23259-thexman/?tab=field_core_pfield_11) ; ; Description: Transform XML string to JSON ; Parameter(s): $sXml - A string containing a valid XML document. ; $sXsl - [optional] A string containing the XSL stylesheet used for transform. ; Return Value(s): Success - A string containing JSON ; Failure - "" and sets @error to a non-zero value. ; @error 1 = Unable to create XML object ; 2 = Unable to create XSL object ; 3 = Unable to parse XML. Make sure XML is valid. ; 4 = Unable to parse XSL. Make sure XSL is valid. ; 5 = XML Transform failed. Make sure you are using a valid v1.0 stylesheet. ; ; Remarks: MSXML 6.0, the COM component used to do the tranformations, only processes ; XSLT 1.0 stylesheets. If you pass a version 2.0+ stylesheet, you WILL get an ; error. ; ; The XSL stylesheet used by default came from: ; https://www.bjelic.net/2012/08/01/coding/convert-xml-to-json-using-xslt/ ; MIT License - Copyright (c) 2012 Bojan Bjelic ;================================================================================================= ;================================================================================================= ; _XmlFile2Json($sXmlFile, $sXsl = Default) ; ; Author: TheXman (https://www.autoitscript.com/forum/profile/23259-thexman/?tab=field_core_pfield_11) ; ; Description: Transform XML file to JSON ; Parameter(s): $sXmlFile - A string containing a valid XML document file path. ; $sXsl - [optional] A string containing the XSL stylesheet used for transform. ; Return Value(s): Success - A string containing the transformed JSON. ; Failure - "" and sets @error to a non-zero value. ; @error -1 = File does not exist ; 1 = Unable to create XML object ; 2 = Unable to create XSL object ; 3 = Unable to parse XML. Make sure XML is valid. ; 4 = Unable to parse XSL. Make sure XSL is valid. ; 5 = XML Transform failed. Make sure you are using a valid v1.0 stylesheet. ; ; Remarks: MSXML 6.0, the COM component used to do the tranformations, only processes ; XSLT 1.0 stylesheets. If you pass a version 2.0+ stylesheet, you WILL get an ; error. ; ; The XSL stylesheet used by default came from: ; https://www.bjelic.net/2012/08/01/coding/convert-xml-to-json-using-xslt/ ; MIT License - Copyright (c) 2012 Bojan Bjelic ;================================================================================================= The transformation is done by doing an XML Transform using a xml-to-json XSL stylesheet. If you want to use your own xml-to-json XSL stylesheet instead of the default one, then you can supply it in the 2nd parameter. The only caveat is that all values are transformed to strings. That means that numeric XML values will be returned as a strings. For example, the numeric value 10.50 will be returned as "10.50". The UDF comes with a couple of example scripts. One example script, which is below, just shows a sample transformation using the included sample XML file. The second example does the transformation and queries the transformed JSON for information. Example-01 ( uses the included sample XML file, Books.xml ) #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 -w 6 -d #include <Constants.au3> #include "xml2json.au3" #include "jq.au3" ; (https://www.autoitscript.com/forum/files/file/502-jq-udf-a-powerful-flexible-json-processor/) example() Func example() Const $XML_FILE = "books.xml" Local $hTimer = -1 Local $sCmdOutput = "", _ $sJson = "" ;Initialize jq environment _jqInit("C:\Utils\JQ\jq-win64.exe") ;<== Path to jq exe If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "Unable to find jq executable - @error = " & @error) $hTimer = TimerInit() ;Convert XML to JSON $sJson = _XmlFile2Json($XML_FILE) If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "_xmlfile2json() Error", "@error = " & @error) ConsoleWrite(StringFormat("Elapsed time to transform XML to JSON: %.3f seconds", TimerDiff($hTimer) / 1000) & @CRLF) ;Pretty-print JSON $sCmdOutput = _jqPrettyPrintJson($sJson, " ") If @error Then MsgBox($MB_ICONERROR + $MB_TOPMOST, "ERROR", "Pretty-print failed - @error = " & @error & " @extended = " & @extended) ConsoleWrite("ERROR:" & @CRLF & $sCmdOutput & @CRLF) Exit EndIf ConsoleWrite($sCmdOutput & @CRLF) EndFunc Output Elapsed time to transform XML to JSON: 0.003 seconds { "catalog": { "book": [ { "id": "bk101", "author": "Gambardella, Matthew", "title": "XML Developer's Guide", "genre": "Computer", "price": "44.95", "publish_date": "2000-10-01", "description": "An in-depth look at creating applications with XML." }, { "id": "bk102", "author": "Ralls, Kim", "title": "Midnight Rain", "genre": "Fantasy", "price": "5.95", "publish_date": "2000-12-16", "description": "A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world." }, { "id": "bk103", "author": "Corets, Eva", "title": "Maeve Ascendant", "genre": "Fantasy", "price": "5.95", "publish_date": "2000-11-17", "description": "After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society." }, { "id": "bk104", "author": "Corets, Eva", "title": "Oberon's Legacy", "genre": "Fantasy", "price": "5.95", "publish_date": "2001-03-10", "description": "In post-apocalypse England, the mysterious agent known only as Oberon helps to create a new life for the inhabitants of London. Sequel to Maeve Ascendant." }, { "id": "bk105", "author": "Corets, Eva", "title": "The Sundered Grail", "genre": "Fantasy", "price": "5.95", "publish_date": "2001-09-10", "description": "The two daughters of Maeve, half-sisters, battle one another for control of England. Sequel to Oberon's Legacy." }, { "id": "bk106", "author": "Randall, Cynthia", "title": "Lover Birds", "genre": "Romance", "price": "4.95", "publish_date": "2000-09-02", "description": "When Carla meets Paul at an ornithology conference, tempers fly as feathers get ruffled." }, { "id": "bk107", "author": "Thurman, Paula", "title": "Splish Splash", "genre": "Romance", "price": "4.95", "publish_date": "2000-11-02", "description": "A deep sea diver finds true love twenty thousand leagues beneath the sea." }, { "id": "bk108", "author": "Knorr, Stefan", "title": "Creepy Crawlies", "genre": "Horror", "price": "4.95", "publish_date": "2000-12-06", "description": "An anthology of horror stories about roaches, centipedes, scorpions and other insects." }, { "id": "bk109", "author": "Kress, Peter", "title": "Paradox Lost", "genre": "Science Fiction", "price": "6.95", "publish_date": "2000-11-02", "description": "After an inadvertant trip through a Heisenberg Uncertainty Device, James Salway discovers the problems of being quantum." }, { "id": "bk110", "author": "O'Brien, Tim", "title": "Microsoft .NET: The Programming Bible", "genre": "Computer", "price": "36.95", "publish_date": "2000-12-09", "description": "Microsoft's .NET initiative is explored in detail in this deep programmer's reference." }, { "id": "bk111", "author": "O'Brien, Tim", "title": "MSXML3: A Comprehensive Guide", "genre": "Computer", "price": "36.95", "publish_date": "2000-12-01", "description": "The Microsoft MSXML3 parser is covered in detail, with attention to XML DOM interfaces, XSLT processing, SAX and more." }, { "id": "bk112", "author": "Galos, Mike", "title": "Visual Studio 7: A Comprehensive Guide", "genre": "Computer", "price": "49.95", "publish_date": "2001-04-16", "description": "Microsoft Visual Studio 7 is explored in depth, looking at how Visual Basic, Visual C++, C#, and ASP+ are integrated into a comprehensive development environment." } ] } } Xml2Json UDF (2022-12-07).zip1 point -
Version v1.7.4
836 downloads
This UDF brings the power and flexibility of jq to AutoIt scripts. jq is an open-source, powerful, and flexible command-line based JSON processor. As it says on their website, jq is like 'sed' for JSON. jq can be used for the simplest of tasks like retrieving JSON objects and values (parsing), to very advanced JSON processing using its numerous built-in functions and conditional processing. Its built-in functions can handle math, selection, conditional processing, mapping, object and array manipulation, flattening, reduction, grouping, and much more. You can even create your own jq functions. You can learn more about jq and even play with it in real-time, using jq's online jq playground, all on their website. Here and some helpful links to get you more familiar with jq, what can be done with it, its built-in functions, and its syntax. jq Home Page: https://jqlang.github.io/jq/ jq Manual: https://jqlang.github.io/jq/manual/ jqWiki (FAQ, Cookbook, Advanced Topics) https://github.com/jqlang/jq/wiki jq is a single 32 or 64 bit executable that has no other dependencies. Just like using the SQLite UDF, the only requirement to use this UDF is that the jq executable reside in a location in which the UDF can execute it. The latest win32 & win64 versions have been included in the UDF download. You can always get newer versions from the jq website. jq at a high level Like 'sed', jq reads JSON in, either through STDIN or one or more files, processes it thru one or more "filters", and outputs the results. You can, optionally, supply "options" that affect how it reads the input, where it gets its "filters", and how it writes its output. It looks a little like this: JSON ---> jq processor (using supplied filters and options) ---> Output So in jq lingo, you basically use "Filters" to tell jq what you want it to do. So in the UDF file, that is why the main functions ( _jqExec() and _jqExecFile() ) refer to filters and options. Please make note that jq works with relatively strict JSON. This means that all JSON read must be conform to the standard. Luckily, jq is pretty good at identifying where a format error exists in non standard JSON. The jq UDF There are 2 main funtions in the UDF file, _jqExec and jqExecFile. With these 2 functions, you can pretty much do anything that jq can do. The only difference between to two functions is whether the JSON is supplied by a string or a file. The 2 primary functions simply call the jq executable with the supplied information, after properly formatting the parameters. There are additional functions in the UDF to easily pretty-print your json, compact-print your json, dump the json data with its associated paths, and see if specific JSON keys exist, but they all just execute the _jqExec or _jqExecFile function with the proper filter. There are also a couple of extra functions to display what version of the UDF and jq executable you are currently using. There are also a couple of functions to enable and disable logging of jq information for debugging purposes. Most of the jq UDF file functions return an @error if unsuccessful. Some also include @extended info. Please see the actual function headers for more information on their usage and return values. The 2 primary functions below just format your jq request and pass it on the jq executable. The functions will also properly escape double quotes (") that are used in the filter. For most simple tasks, you just need to supply the JSON source and a filter. _jqExec($sJson, $sFilter, $sOptions = Default, $sWorkingDir = Default) Or _jqExecFile($sJsonFile, $sFilter, $sOptions = Default, $sWorkingDir = Default) Using jq in your script As stated earlier, the jq executable must reside somewhere where the script can locate and execute it. The _jqInit() function always has to be executed before any jq processing occurs. _jqInit() merely locates the executable or uses the supplied path. It also clears any previous debug log. The jq UDF folder contains a jq example script that has several examples to how to do some of the most common JSON processing tasks. Here are a few examples to get you started: How to pretty-print some JSON #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"fruits":[{"Apple":{"color":"Red","season":"Fall"}}, {"Banana":{"color":"Yellow","season":"Summer"}}]}' $sCmdOutput = _jqPrettyPrintJson($sJson) ConsoleWrite(@CRLF & "Pretty-Print JSON" & @CRLF & $sCmdOutput & @CRLF) How to compact-print some JSON #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{ "fruits" : [{"Apple" : {"color":"Red","season":"Fall"}}, {"Banana":{"color":"Yellow","season":"Summer"}}]}' $sCmdOutput = _jqCompactPrintJson($sJson) ConsoleWrite(@CRLF & "Compact-Print JSON" & @CRLF & $sCmdOutput & @CRLF) Dump JSON data (paths and values) #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{ "fruits" : [{"Apple" : {"color":"Red","season":"Fall"}}, {"Banana":{"color":"Yellow","season":"Summer"}}]}' $sCmdOutput = _jqDump($sJson) ConsoleWrite(@CRLF & "Dump JSON paths and values" & @CRLF & $sCmdOutput & @CRLF) How to GET JSON values #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple" : {"color":"Red","season":"Fall"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = '.Banana.color' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("Get color of banana" & @CRLF) ConsoleWrite("Input: : " & _jqCompactPrintJson($sJson) & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) or #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple" : {"color":"Red","season":"Fall"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = 'getpath(["Banana", "color"])' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("Get color of banana" & @CRLF) ConsoleWrite("Input: : " & _jqCompactPrintJson($sJson) & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) Check for the existence of a key #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple":{"color":"Red","season":"Fall"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = '.Banana | has("color")' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("Check for existence of color key within Banana object" & @CRLF) ConsoleWrite("Input: : " & _jqCompactPrintJson($sJson) & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) Count of how many Items in an object #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple":{"color":"Red"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = '.Banana | length' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("How many items in the Banana object" & @CRLF) ConsoleWrite("Input: : " & _jqCompactPrintJson($sJson) & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) How to PUT/Create/Modify JSON #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sInput = "" $sFilter = 'setpath(["Apple","color"];"Red") | setpath(["Banana","color"];"Yellow") | setpath(["Banana","season"];"Summer")' $sOptions = '-n' ;required if no input supplied $sCmdOutput = _jqExec($sInput, $sFilter, $sOptions) ConsoleWrite("Update/Create JSON" & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & @CRLF & $sCmdOutput & @CRLF) List all of the fruits (top-level keys) #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '{"Apple":{"color":"Red"}, "Banana":{"color":"Yellow","season":"Summer"}}' $sFilter = 'keys | .[]' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("List all top-level keys (fruits)" & @CRLF) ConsoleWrite("Input : " & $sJson & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & @CRLF & $sCmdOutput & @CRLF) Calculate the sum of all of the objects' price * qty #include "jq.au3" ;Initialize jq environment _jqInit() If @error Then Exit ConsoleWrite("ERROR: Unable to initialize jq - @error = " & @error & @CRLF) $sJson = '[{"id":1,"price":20.00,"qty":10},{"id":2,"price":15.00,"qty":20.25},{"id":3,"price":10.50,"qty":30}]' $sFilter = 'map(.price * .qty) | add' $sCmdOutput = _jqExec($sJson, $sFilter) ConsoleWrite("Calculate the sum of all of the objects' price * qty" & @CRLF) ConsoleWrite("Input : " & $sJson & @CRLF) ConsoleWrite("Filter : " & $sFilter & @CRLF) ConsoleWrite("Output : " & $sCmdOutput & @CRLF) The examples above, and the ones in the example files, merely scratch the surface of what jq can do. It may look intimidating at first but it really isn't that bad once you start playing with it. You can find several more examples and play around with them or create your own using jqPlayground. If you have any questions regarding the UDF, or how to perform a certain task using jq, I'll try my best to answer them. Since jq has been around for a while now, there's also several jq-related questions and answers on StackOverflow.1 point -
Autoit and Scite On Win 11
argumentum reacted to AutoitMike for a topic
I got the following error: ! We intercepted a COM Error ! ! err.description is: ! err.windescription: Invalid class string ! err.number is: 800401F3 ! err.lastdllerror is: 0 ! err.scriptline is: 8 ! err.source is: ! err.helpfile is: ! err.helpcontext is: !>15:24:06 AutoIt3.exe ended.rc:123 +>15:24:06 AutoIt3Wrapper Finished. >Exit code: 123 Time: 1.513 It works ok on my win 7 laptop I ordered a full install of Office 2007 on Ebay I'll see how that goes. Thanks1 point -
Will do as it probably makes sense, but I am sure this will not work properly yet at that point in the script as not all of those possible variables have their value known. EDIT: Will add $INP_Icon to Func Convert_required_DirectiveValues() nobody has even tried to use it till now and it wasn't my intent to do the Conversion of %xxx% on all possible directives/INI keywords as their probably will be another can-of-worms I open with that.1 point
-
That is not how it is working. The reason for the multiple options has to do with the portability of SciTE and its tools. When SCITE_USERHOME is defined it is assumed that the AutoIt3Wrapper.ini is located in %SCITE_USERHOME %\AutoIt3Wrapper\AutoIt3Wrapper.ini. This was introduced when settings moved from Program Files to User directories and the "require admin rights to update files in program files" was added to Windows. When SCITE_HOME is defined it is assumed that the AutoIt3Wrapper.ini is located in %SCITE_HOME %\AutoIt3Wrapper\AutoIt3Wrapper.ini. This is the original setting used in SciTE before the previous was added and all configs were in the program directory. Else we assume it is portable and located in the "SciTE.exe directory"\AutoIt3Wrapper\AutoIt3Wrapper.ini. Introduced for the portable option when no Environment variables are defined. There is a long history around this but this is how it has been for a long time now. Close but not correct. see my explanation at the start of this post. Jos1 point
-
Back when the issue regarding not being able to access keys that have periods in them was posted HERE on 9/18, I took a look at the issue and fixed my local copy. Then, I saw the post HERE on 9/28 that had the same issue. After mulling it over a bit, I decided to share my fix (attached below). Even though there are other JSON UDF's available that do not have this issue, I decided that it was still important to offer a fix since this UDF lib is widely used and very fast when doing simple parsing. Of course one can access keys with periods in them by directly accessing the underlying dictionary, where the key/value pairs are actually stored. However, that doesn't address being able to access & manipulate such keys, using dot-notation and bracket-notation, with the Json_Get() and Json_Put() functions. Only 4 lines in the most current version needed to be modified, 2 lines in Json_Get() and 2 lines in Json_Put(). I could go into a detailed analysis of the root cause(s) of the issue and why I chose to fix it the way I did, but I'm sure that most don't care. All anyone really cares about is that it works. 😉 I left the Json_ObjGet() and Json_ObjExists() helper functions as-is. Although those 2 helper functions are related to the issue, they are not needed for Json_Get() and Json_Put() to correctly traverse a mutli-level JSON notation that has special characters like slashes, spaces, brackets, and periods. The example script below shows keys with periods, spaces, brackets, and slashes, being created, accessed, and modified, using Json_Put() and Json_Get(): #include <Constants.au3> ;~ #include "Json.au3" #include "Json(2022-09-18)_TheXman.au3" ;<== Modified json.au3 (only 4 lines updated) Const $JSON = _ '{' & _ ' "dual_engine": {' & _ ' "user_list_data_1": {' & _ ' "https://www.yahoo.com/": {' & _ ' "date_added": "13308840098237395",' & _ ' "engine": 2,' & _ ' "visits_after_expiration": 0' & _ ' }' & _ ' }' & _ ' },' & _ ' "VST.magic": "Test",' & _ ' "VST3.uid": [2229853791, 2455052834, 2533024787],' & _ ' "pluginName": "Omnisphere",' & _ ' "pluginVendor": "Spectrasonics"' & _ '}' json_example() Func json_example() Local $oJson ;Decode JSON into a dictionary object $oJson = Json_Decode($JSON) If @error Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "JSON DECODE ERROR", "@error = " & @error) ;Pretty-print the original JSON log_line("=== Pretty-Printed JSON (original) ===") log_line(Json_Encode($oJson, $JSON_PRETTY_PRINT + $JSON_UNESCAPED_SLASHES, " ") & @CRLF) ;Update an existing key / Add some valid keys with spaces, slashes, and periods Json_Put($oJson, '.dual_engine.user_list_data_1."https://www.yahoo.com/".visits_after_expiration', 3) ;Update key's value to 3 Json_Put($oJson, '."//a.b.c//".". [.] ."', "Value of ridiculous but valid key (. [.] .)") ;Add key Json_Put($oJson, '."//a.b.c//"."/ /"' , "Value of another ridiculous but valid key (/ /)") ;Add key Json_Put($oJson, '."key with spaces"' , "Value of key with spaces") ;Add key Json_Put($oJson, '."lvl1.key"."lvl2.key1"."lvl3.key1"' , "Level 3 Key1") ;Add key using dot-notation Json_Put($oJson, '["lvl1.key"]["lvl2.key1"]["lvl3.key2"]', "Level 3 Key2") ;Add key using bracket-notation ;Pretty-print the updated JSON log_line("=== Pretty-Printed JSON (with keys updated/added) ===") log_line(Json_Encode($oJson, $JSON_PRETTY_PRINT + $JSON_UNESCAPED_SLASHES, " ") & @CRLF) ;Display some of the JSON values log_line('=== Display some JSON keys & values ===') log_line('."//a.b.c//".". [.] ." => ' & Json_Get($oJson, '."//a.b.c//".". [.] ."')) log_line('."//a.b.c//"."/ /" => ' & Json_Get($oJson, '."//a.b.c//"."/ /"')) log_line('."key with spaces" => ' & Json_Get($oJson, '."key with spaces"')) log_line() log_line('.dual_engine.user_list_data_1."https://www.yahoo.com/".date_added => ' & _ Json_Get($oJson, '.dual_engine.user_list_data_1."https://www.yahoo.com/".date_added')) log_line('[dual_engine][user_list_data_1]["https://www.yahoo.com/"][engine] => ' & _ Json_Get($oJson, '[dual_engine][user_list_data_1]["https://www.yahoo.com/"][engine]')) log_line('.dual_engine.user_list_data_1."https://www.yahoo.com/".visits_after_expiration => ' & _ Json_Get($oJson, '.dual_engine.user_list_data_1."https://www.yahoo.com/".visits_after_expiration')) log_line() log_line('."VST.magic" => ' & Json_Get($oJson, '."VST.magic"')) log_line('."VST3.uid"[0] => ' & Json_Get($oJson, '."VST3.uid"[0]')) log_line() log_line('."lvl1.key"."lvl2.key1"."lvl3.key1" => ' & Json_Get($oJson, '."lvl1.key"."lvl2.key1"."lvl3.key1"')) log_line('["lvl1.key"]["lvl2.key1"]["lvl3.key1"] => ' & Json_Get($oJson, '["lvl1.key"]["lvl2.key1"]["lvl3.key1"]')) EndFunc Func log_line($sMsg = "") ConsoleWrite($sMsg & @CRLF) EndFunc Console Output: === Pretty-Printed JSON (original) === { "dual_engine": { "user_list_data_1": { "https://www.yahoo.com/": { "date_added": "13308840098237395", "engine": 2, "visits_after_expiration": 0 } } }, "VST.magic": "Test", "VST3.uid": [ 2229853791, 2455052834, 2533024787 ], "pluginName": "Omnisphere", "pluginVendor": "Spectrasonics" } === Pretty-Printed JSON (with keys updated/added) === { "VST.magic": "Test", "VST3.uid": [ 2229853791, 2455052834, 2533024787 ], "pluginName": "Omnisphere", "pluginVendor": "Spectrasonics", "dual_engine": { "user_list_data_1": { "https://www.yahoo.com/": { "date_added": "13308840098237395", "engine": 2, "visits_after_expiration": 3 } } }, "//a.b.c//": { ". [.] .": "Value of ridiculous but valid key (. [.] .)", "/ /": "Value of another ridiculous but valid key (/ /)" }, "key with spaces": "Value of key with spaces", "lvl1.key": { "lvl2.key1": { "lvl3.key1": "Level 3 Key1", "lvl3.key2": "Level 3 Key2" } } } === Display some JSON keys & values === ."//a.b.c//".". [.] ." => Value of ridiculous but valid key (. [.] .) ."//a.b.c//"."/ /" => Value of another ridiculous but valid key (/ /) ."key with spaces" => Value of key with spaces .dual_engine.user_list_data_1."https://www.yahoo.com/".date_added => 13308840098237395 [dual_engine][user_list_data_1]["https://www.yahoo.com/"][engine] => 2 .dual_engine.user_list_data_1."https://www.yahoo.com/".visits_after_expiration => 3 ."VST.magic" => Test ."VST3.uid"[0] => 2229853791 ."lvl1.key"."lvl2.key1"."lvl3.key1" => Level 3 Key1 ["lvl1.key"]["lvl2.key1"]["lvl3.key1"] => Level 3 Key1 Json(2022-09-18)_TheXman.au31 point
-
well..... miracles won't happen when using AutoIt3 when it doesn't work with basics. This likely is some sort of proxy setup basically disabling most direct (routed) IP traffic and you get these type of errors.1 point
-
I guess all these "issues" you have says something about how often people really use these as this has been like this for years. Made another couple of changes to do the updates for the resources at a different point in the process to ensure all info is know at that point. Try the latest beta which should fix this one. Jos1 point
-
To be honest I never used it. But the eloquence of my explication should have move you so deep, emotionally, that the requested change would have been attended to immediately and with out challenge. You see, that's why I tend to use emojis to compel those I reach 💛 In my prior posting I did not use any emoji, hence the intellectual challenge 💢 In the future, rest assured, a greater number of these will be use 😿1 point
-
In the autoit_changelog.txt you can find : 3.3.14.0 (10th July, 2015) (Release) AutoIt: - Changed: Minimum OS requirements are now Windows XP SP3 and Windows Server 2003 SP2. The newer versions do not list any restrictions regarding Windows XP (as already mentioned by @pixelsearch ).1 point
-
Last Version for Windows XP
RichardL reacted to pixelsearch for a topic
On the same web page we can read this : Overview You can download the main AutoIt package and other related scripting tools from this page. The current version of AutoIt has works on the following operating systems: Windows XP and Windows Server 2003 Windows Vista and Windows Server 2008/2008 R2 Windows 7 / 8 / 10 / 11 So Windows XP is fully supported by the actual version of AutoIt (release 3.3.16.1 dated Sept 19, 2022)1 point -
Help File/Documentation Issues. (Discussion Only)
funkey reacted to pixelsearch for a topic
This function exists in Windows but not in AutoIt. Let's have a look at these 4 msdn web pages : Private fonts : AddFontResourceExW (this function allows a process to use fonts without allowing other processes access to the fonts) RemoveFontResourceExW Public fonts : AddFontResourceW (the fonts can subsequently be used for text output by any application) RemoveFontResourceW Following msdn recommandations, here is a quick script showing how these 4 functions (4, not 2 as in actual AutoIt) could have been scripted. Actually the 2 functions found in AutoIt ( _WinAPI_AddFontResourceEx and _WinAPI_RemoveFontResourceEx ) come directly from Yashied's code (written in 2012) where he mixed the 4 msdn functions to create only 2 AutoIt functions. ; no include files in this script (+++) Global Const $GUI_EVENT_CLOSE = -3, $BS_MULTILINE = 0x2000, $FR_PRIVATE = 0x10, $FR_NOT_ENUM = 0x20 Example() Func Example() Local $sFontFile = StringLeft(@AutoItExe, StringInStr(@AutoItExe, '\', 0, -1) -1) & '\Examples\Helpfile\Extras\SF Square Head Bold.ttf' ; >>>>>>>> Add a private font (not usable by other applications) Local $hGUI = GUICreate("PRIVATE font (not listed in NotePad)", 720, 235) Local $idButton = GUICtrlCreateButton("AutoIt" & @CRLF & "forever", 100, 32, 520, 170, $BS_MULTILINE) _WinAPI_AddFontResourceEx($sFontFile) If @error Then ConsoleWrite("@error 1 = " & @error & @crlf) GUICtrlSetFont($idButton, 28, 0, 0, "SF Square Head Bold") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _WinAPI_RemoveFontResourceEx($sFontFile) If @error Then ConsoleWrite("@error 2 = " & @error & @crlf) GUIDelete($hGUI) ; >>>>>>>> Add a public font (usable by other applications) Local $hGUI = GUICreate("PUBLIC font (listed in NotePad)", 720, 235) Local $idButton = GUICtrlCreateButton("AutoIt" & @CRLF & "forever", 100, 32, 520, 170, $BS_MULTILINE) _WinAPI_AddFontResource($sFontFile) If @error Then ConsoleWrite("@error 3 = " & @error & @crlf) GUICtrlSetFont($idButton, 28, 0, 0, "SF Square Head Bold") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _WinAPI_RemoveFontResource($sFontFile) If @error Then ConsoleWrite("@error 4 = " & @error & @crlf) GUIDelete($hGUI) EndFunc ;==>Example ;---------------------------------------------------------- Func _WinAPI_AddFontResourceEx($sFont, $iFlag = $FR_PRIVATE) ; add private font Local $aRet = DllCall('gdi32.dll', 'int', 'AddFontResourceExW', 'wstr', $sFont, 'dword', $iFlag, 'ptr', 0) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinAPI_AddFontResourceEx ;---------------------------------------------------------- Func _WinAPI_RemoveFontResourceEx($sFont, $iFlag = $FR_PRIVATE) ; remove private font Local $aRet = DllCall('gdi32.dll', 'bool', 'RemoveFontResourceExW', 'wstr', $sFont, 'dword', $iFlag, 'ptr', 0) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, False) Return $aRet[0] EndFunc ;==>_WinAPI_RemoveFontResourceEx ;=========================================================== Func _WinAPI_AddFontResource($sFont) ; add public font Local $aRet = DllCall('gdi32.dll', 'int', 'AddFontResourceW', 'wstr', $sFont) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, 0) Local Const $WM_FONTCHANGE = 0x001D Local Const $HWND_BROADCAST = 0xFFFF DllCall('user32.dll', 'none', 'SendMessage', 'hwnd', $HWND_BROADCAST, 'uint', $WM_FONTCHANGE, 'wparam', 0, 'lparam', 0) Return $aRet[0] EndFunc ;==>_WinAPI_AddFontResource ;=========================================================== Func _WinAPI_RemoveFontResource($sFont) ; remove public font Local $aRet = DllCall('gdi32.dll', 'bool', 'RemoveFontResourceW', 'wstr', $sFont) If @error Or Not $aRet[0] Then Return SetError(@error, @extended, False) Local Const $WM_FONTCHANGE = 0x001D Local Const $HWND_BROADCAST = 0xFFFF DllCall('user32.dll', 'none', 'SendMessage', 'hwnd', $HWND_BROADCAST, 'uint', $WM_FONTCHANGE, 'wparam', 0, 'lparam', 0) Return $aRet[0] EndFunc ;==>_WinAPI_RemoveFontResource1 point