What Data serialisation formats are known to be supported on AutoHotkey? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ralf_Reddings200244
Posts: 85
Joined: 11 Mar 2023, 14:16

What Data serialisation formats are known to be supported on AutoHotkey?

Post by Ralf_Reddings200244 » 09 Jun 2023, 13:20

So I am looking to go beyond my days of simple string parsing and start doing things the right way, I really want to advance my programming competency.
One other language besides AHK, that I use heavily is PowerShell, it is known for its strong support of Json, XML, CSV right out of the box.

I would like to be able to serialise and desterilise data using Json, XML and CSV in AutoHotkey too. I have done some searching for Json, XML and CSV in AHK and have only managed to come to a conclusion in the Json case. G33kDude's own benchmark says its highly performant. He also maintains it, and is working on a V2 port.

Sadly I have not come across any good solutions for CSV and XML. I found random sporadic libraries that are on the old libraries.

In the case of XML, I noticed allot of the code examples were using something like:

Code: Select all

XMLDoc := loadXML(Instructions)
o :=	ComObjCreate("MSXML2.DOMDocument.6.0")
o.async :=	false
o.loadXML(data)
Searching the term "MSXML2" landed me o MSXML1 | Microsoft Learn) :
>Microsoft XML Core Services (MSXML) provides a comprehensive set of W3C compliant XML APIs for building high-performance XML-based applications. The detail variations, clarifications, and extensions to certain final approved web standards supported by MSXML 3.0 and MSXML 6.0 are documented in Internet Explorer Standards Support Documentation..
Is this what I think it means? That its essentially possible to create XML documents from scratch/read from disk etc via COM? If so, are there any performance loss with this method as opposed to something AHK can natively do?
Is this even proffered method AutoHotkey programmers like to create/read from disk/write to disk XML files? If so it would explain why there is no library dedicated to it.


I still have not found a way to go about working with CSV, My favourite of the three.

Image
Thanks!

User avatar
RaptorX
Posts: 371
Joined: 06 Dec 2014, 14:27
Contact:

Re: What Data serialisation formats are known to be supported on AutoHotkey?  Topic is solved

Post by RaptorX » 10 Jun 2023, 13:27

Native support for serialization is limited to INI and CSV, namely the IniDelete,
IniRead, IniWrite and the Loop Parse with CSV delimiters.

XML Support can be achieved with the MSXML ComObject and yes, you can create from scratch, load from strings and edit/modify anything you want.

JSON support is only achieved through 3rd party libraries. If you are using V1, G33kDude's cJSON is my goto, and if you are using V2 the one by thqby JSON parser is the best I have found.

We have been having a conversation regarding Built-In JSON support here: Any plans to support JSON?.

No real answers as of yet, but I hope we get that at some point.
Projects:
AHK-ToolKit

Ralf_Reddings200244
Posts: 85
Joined: 11 Mar 2023, 14:16

Re: What Data serialisation formats are known to be supported on AutoHotkey?

Post by Ralf_Reddings200244 » 10 Jun 2023, 19:16

RaptorX wrote:
10 Jun 2023, 13:27
Hey thanks for your answer. I am pretty much happy with your answer.

I went through the thread your linked, it was an intresting read for sure, I am in agreement with you. Hopefull Lexikos considers it once he reaches V2.1

Post Reply

Return to “Ask for Help (v1)”