tarretarretarre Posted August 27, 2020 Posted August 27, 2020 (edited) About Serialize Serialize a given value to get it's string representation, that you can later unSerialize back to its original value. Including nested arrays and objects. This is useful for storing and transferring data between applications. 2021-02-14 update: you can now serialize and unSerialize data in JavaScript as well. Checkout the official npm package or the github repo. This makes it possible to pass data between AutoIt and JavaScript applications. Eventually I will make an package for PHP aswell. Limitations Mutli dim arrays are not supported Examples Basic example #include "Serialize.au3" #include <Array.au3> ; Define some data Global $array = [1,2,3] ; Serialize Global $serialized = _Serialize($array) MsgBox(64, "Serialized data", $serialized) ; Unserialize Global $unSerialized = _UnSerialize($serialized) _ArrayDisplay($unSerialized) Objects and nesting #include "Serialize.au3" #include <Array.au3> ; Define some data Global $preArray = [1, 2, 3] Global $array = [5, 6, $preArray] Global $obj = ObjCreate("Scripting.Dictionary") $obj.add("firstName", "Tarre") $obj.add("age", 29) $obj.add("array", $array) $obj.add("active", True) ; Serialize Global $serialized = _Serialize($obj) MsgBox(64, "Serialized data", $serialized) ; Unserialize Global $unSerialized = _UnSerialize($serialized) MsgBox(64, "Unserialized data", "firstName = " & $unSerialized.item("firstName") & @LF & "age = " & $unSerialized.item("age") & @LF & "active = " & $unSerialized.item("active")) Global $array = $unSerialized.item("array") Global $preArray = $array[2] _ArrayDisplay($array, "$array") _ArrayDisplay($preArray, "$preArray") The code is also available on Github Autoit-Serialize-1.0.0.zip Edited February 14, 2021 by tarretarretarre Danyfirex and Zmy 2 Socket-IO - An event-driven TCP UDF (Realtime chat example) AutoIt-API-WS - An expressive HTTP server you can use to build your own API with (Screenshots)
tarretarretarre Posted February 14, 2021 Author Posted February 14, 2021 2021-02-14 update: you can now serialize and unSerialize data in JavaScript as well. Checkout the official npm package or the github repo. This makes it possible to pass data between AutoIt and JavaScript applications. Eventually I will make an package for PHP aswell. Socket-IO - An event-driven TCP UDF (Realtime chat example) AutoIt-API-WS - An expressive HTTP server you can use to build your own API with (Screenshots)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now