Jump to content

Recommended Posts

Posted
2 minutes ago, Musashi said:

As far as I know, this UDF works with datatype Maps and therefore requires AutoIt version 3.3.16.1 or higher.

Thank you Sir!

  • 1 year later...
Posted

Any reason for having $s_String as "ByRef" in _JSON_Parse ?

I have a use case for minimal script, and wish to embed the JSON string directly in the _JSON_Parse such as

$search = _JSON_Parse('{"name":"Sean"}')
$s_Type = $search.name

I took the "ByRef" keyword out of _JSON_Parse and seems to work?

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia
Posted (edited)

That had performance reasons. With a classic ByRef, large strings have to be duplicated when they are transferred. As the function also works recursively, this would take place several times and would have a corresponding impact on performance.

Important: “Would have”. In fact, AutoIt has quite obviously built in a kind of COW mechanism. This means that a copy is not created automatically, but only when the content is actually changed in the function. However, I do not know this with certainty but only deduce it from the performance behavior.

The important point is: ByRef has no (more?) influence on the performance of the _JSON_Parse() function.

So the recommendation would actually be to remove ByRef to enable direct string inputs.
Which I have just done myself and adapted the repository accordingly.

Edited by AspirinJunkie
Posted (edited)

Once you are confortable with your script, you can remove au3check (or compile, or run from Explorer) then you can use direct string even with ByRef.

#AutoIt3Wrapper_Run_Au3Check=n

Func Test(ByRef $sString)
  MsgBox(0, "Test", $sString)
EndFunc

Test("This is a test")

Meanwhile, you can fool au3check by having a wrapper of the original (included) function.  Since au3check is a single pass process, it won't detect if you use it like this :

Func Test(ByRef $sString)
  MsgBox(0, "Test", $sString)
EndFunc

TestEx("This is a test")

Func TestEx(ByRef $sString)
  Test($sString)
EndFunc

That way you still get the benefit of ByRef all the time...

Edited by Nine

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...