Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/03/2023 in all areas

  1. Introduction JSON is a pure data exchange format. Basically you only have to deal with JSON in 2 places in a program: Once when reading JSON data and once when outputting data. In between it should not really matter that the data used to be JSON or should be converted to it. You should not need any special intermediate structures but only the elements that the respective programming language provides anyway. This is exactly the approach of this UDF: There is the function _JSON_Parse(), which converts an arbitrary JSON string into (nested) pure AutoIt data types (Arrays, Maps, Strings, Numbers, Null, True, False). And on the other side we have the function _JSON_Generate(), which generates a JSON string from arbitrary (nested) AutoIt data structures. Import and export JSON So how to use - let`s give an example: Handling nested data structures JSON is often very nested. The resulting AutoIt data is therefore naturally also nested, which makes it somewhat cumbersome to process with pure AutoIt on-board methods. For this reason, the UDF comes with a few helper functions that make life with this data easier. One of them is _JSON_Get(), which allows you to access deeply nested data with a simple query syntax. On the other hand there is the function _JSON_addChangeDelete() with which you can (the name already says it) change, add and delete data. You can even easily create deeply nested structures with a single call. Again, here is a small example of how to use it: Strictly speaking, these functions should not even have "JSON" in their names, since they are generally applied to data structures in AutoIt. However, since they are often used in the JSON environment, we allow ourselves this small inaccuracy. Why should i give it a try? Probably the most common method to deal with JSON in AutoIt is the variant via JSMN. My minor dissatisfactions with this approach led me to write this UDF in the first place a few years ago. So the incentives are quite JSMN related: Parsing and extraction of data is faster than in JSMN. (Only if the JSON string makes heavy use of JSON escapes should JSMN be a bit faster in parsing, since the escapes are resolved later.) Editing the data is easier, because you don't need special commands for the JSMN intermediate structure but deal directly with AutoIt structures. Generating JSON is also simple: build your structure in AutoIt as you like and then let it generate a JSON string for you with _JSON_Generate(). The UDF is smaller (28kb vs. 45kb) The UDF is in pure AutoIt. You can directly customize any behavior as you like. >>sourcecode and download on github<<
    1 point
  2. Just comment out the last line in the function.
    1 point
  3. Use function _OL_ItemAttachmentAdd to add an attachment to a mail item. See the example script _OL_ItemAttachmentAdd.au3
    1 point
  4. I owe you an apology I didn't understand what exactly you did, I downloaded it, I ran it and as it was natural, it gave me an error because it couldn't find the variables. Now that I saw it better I understood that I had to put it in the program, and replace the function, and yes it works !! (I didn't check if it catches all the cases) amazing job well done and sorry again
    1 point
  5. Celebrating one thousand downloads of the bundle.
    1 point
  6. hi, Dan_555, acording to the page,i tried to write the code, there is quite a lot of command and syntax i do not understand, but efficiently solve my 4 problem. when i click google, it will execute ShellExecute("google.com"). it is perfect.
    1 point
  7. json_decode returns the structure as it is mapped in the json-string. If the outermost element in the json-string is an array definition, then json_decode returns an array. On the other hand, if it is an object, then json-decode returns a Scripting.Dictionary object. If the json-string is just a number, then json-decode just returns a number type. The function json_decode maps the json-string into (nested) AutoIt data types. Therefore, you must use the structure of the json-string as a guide when processing the output of json_decode.
    1 point
  8. It's certainly possible, what you need is in my updated UDF file, since it has the code in there that handles both row and column tabbing. You would just remove the part that handles moving the column to the right and keep the part that moves the row down. Give it a shot, everything you should need is in the __ListViewEditInput_GoToNextCell() function of my file. Again, Kanashius's example might also work for what you're looking to do, but I haven't looked at it enough to know.
    1 point
  9. Found it: If Mod(@MIN, 5) = 0 Then
    1 point
×
×
  • Create New...