Kanashius Posted yesterday at 12:28 AM Posted yesterday at 12:28 AM (edited) This is an UDF to print the content and type of any variable. This includes basic datatypes, as well as all data in multidimensional arrays, DllStructs, Maps, some Objects like Dictionaries,... Basically any datatype I could think of. By Default, the datatype is given, this can be turned of. Additionally the spacing can be tuned to ones liking. I hope you like it and feel free to provide some feedback for improvement. Example: Spoiler expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.16.1 Author: Kanashius Script Function: Example script to show the usages of the ToString UDF. #ce ---------------------------------------------------------------------------- #include "ToString.au3" ; prepare example data Local $mData[] Local $ar1D = [1, 2, 3, 4] $mData.arr1D = $ar1D Local $ar2D = [[1, 2], [3, 4]] $mData.arr2D = $ar2D Local $ar3D = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]] $mData.arr3D = $ar3D $mData.binary = Binary(0xFF2312302343221) $mData.bool = True Local $tStruct = DllStructCreate("struct;int var1;byte var2;uint var3;char var4[128];endstruct") DllStructSetData($tStruct, "var1", -1) DllStructSetData($tStruct, 2, 255) DllStructSetData($tStruct, "var3", -1) DllStructSetData($tStruct, "var4", "Hello") $mData.dllStruct = $tStruct $mData.func = _toString $mData.float = 0.341234 $mData.hwnd = WinGetHandle("[ACTIVE]") $mData.int = 3213 $mData.objDictionary = ObjCreate('Scripting.Dictionary') $mData.objDictionary.add("1", "eins") $mData.objDictionary.add(2, "zwei") $mData.object = ObjCreate("MediaPlayer.MediaPlayer.1") $mData.pointer = DllStructGetPtr($tStruct) $mData.string = "Something" _ToStringC($mData, True) ; = ConsoleWrite(_ToString($mData, True)&@crlf) ; To get a compact view ; _ToStringC($mData, False, "", "", " ") Output: Spoiler expandcollapse popupMap[14] { string "arr1D": Array[4] [ int "1", int "2", int "3", int "4" ], string "arr2D": Array[2][2] [ [ int "1", int "2" ], [ int "3", int "4" ] ], string "arr3D": Array[2][2][2] [ [ [ int "1", int "2" ], [ int "3", int "4" ] ], [ [ int "5", int "6" ], [ int "7", int "8" ] ] ], string "binary": binary "0x213234022331F20F", string "bool": bool "true", string "dllStruct": DllStruct[b140]{ int "-1", int "255", int "4294967295", string "Hello", }, string "func": function "_TOSTRING", string "float": float "0.341234", string "hwnd": hwnd "0x018809E0", string "int": int "3213", string "objDictionary": Object "Dictionary" Description: "Scripting.Dictionary" [2]{ string "1": string "eins", int "2": string "zwei", }, string "object": Object "MediaPlayer" Description: "Windows Media Player", string "pointer": pointer "0x018570C0", string "string": string "Something", } ToString.au3 ToString Example.au3 Edited yesterday at 12:37 AM by Kanashius My Website: Kanashius Webside (Some of my Programs you can find there)
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