[Q] How to pass Properties (Array of String) to Method (e. g. createPlainTextQRCode)

I am trying to grasp the InDesign ExtendScript API-Documentation but do not understand how to pass properties to the method.

The method createPlainTextQRCode accepts three parameters according to the documentation:

plainText: *String*
qrCodeSwatch: *Varies Swatch String*
withProperties: *Array of String*

The description for withProperties states:
Initial values for properties of the new Button. Above parameters can also be passed as properties (Optional).

If I pass two parameters (plainText and qrCodeSwatch) like the following example code it works:

QRCode.createPlainTextQRCode("BEGIN:VEVENT\nSUMMARY:Foo\nLOCATION:Nowhere\n\nDTSTART:20260812T165800Z\nDTEND:20260812T183400Z\nEND:VEVENT", "C=100 M=90 Y=10 K=0");

When trying to add some properties (from Property Listing) to the method call like this, the properties {visible: false, locked: true, name: "Foo"} are ignored:

QRCode.createPlainTextQRCode("BEGIN:VEVENT\nSUMMARY:Foo\nLOCATION:Nowhere\n\nDTSTART:20260812T165800Z\nDTEND:20260812T183400Z\nEND:VEVENT", "C=100 M=90 Y=10 K=0", {visible: false, locked: true, name: "Foo"});

The following attempt to pass the properties as an array throws an exception:
QRCode.createPlainTextQRCode("BEGIN:VEVENT\nSUMMARY:Foo\nLOCATION:Nowhere\n\nDTSTART:20260812T165800Z\nDTEND:20260812T183400Z\nEND:VEVENT", "C=100 M=90 Y=10 K=0", [visible: false, locked: true, name: "Foo"]);

Passing plain key/value-pairs throws an exception too:
QRCode.createPlainTextQRCode("BEGIN:VEVENT\nSUMMARY:Foo\nLOCATION:Nowhere\n\nDTSTART:20260812T165800Z\nDTEND:20260812T183400Z\nEND:VEVENT", "C=100 M=90 Y=10 K=0", visible: false, locked: true, name: "FOO");

Am I just using the wrong syntax or have I misinterpreted the documentation in some way?

##################################################################

In case you wanna play around, here is the plain simple code snippet:

var doc = app.activeDocument;

var QRCode = doc.pages[0].textFrames.add ({ 
        geometricBounds : [ 60,20,150,120 ]
    } 
);

QRCode.createPlainTextQRCode("BEGIN:VEVENT\nSUMMARY:Foo\nLOCATION:Nowhere\n\nDTSTART:20260812T165800Z\nDTEND:20260812T183400Z\nEND:VEVENT", "C=100 M=90 Y=10 K=0");

// QRCode.createPlainTextQRCode("BEGIN:VEVENT\nSUMMARY:Foo\nLOCATION:Nowhere\n\nDTSTART:20260812T165800Z\nDTEND:20260812T183400Z\nEND:VEVENT", "C=100 M=90 Y=10 K=0", {visible: false, locked: true, name: "Foo"});
// QRCode.createPlainTextQRCode("BEGIN:VEVENT\nSUMMARY:Foo\nLOCATION:Nowhere\n\nDTSTART:20260812T165800Z\nDTEND:20260812T183400Z\nEND:VEVENT", "C=100 M=90 Y=10 K=0", [visible: false, locked: true, name: "Foo"]);
// QRCode.createPlainTextQRCode("BEGIN:VEVENT\nSUMMARY:Foo\nLOCATION:Nowhere\n\nDTSTART:20260812T165800Z\nDTEND:20260812T183400Z\nEND:VEVENT", "C=100 M=90 Y=10 K=0", visible: false, locked: true, name: "Foo");

##################################################################

Allthough, properties can be assigned to the textFRames-Object like this:

var QRCode = doc.pages[0].textFrames.add ({ 
        geometricBounds : [ 60,20,150,120 ],
        name: "QR Code",
        locked: true,
        visible: true
    } 
);

it is not what I am looking for. I would really like to understand the withProperties part of the createPlainTextQRCode method.

Probably the method just draws a QRCode shape on the specified PageItem; there is no such type as QRCode.

Therefore, the visible: false or name: “Foo” you want to specify should be given to the original PageItem, and you don’t need to use withProperties?

@sttk3

I apologize for the confusion. :pray:

I should have sent the complete code with my first post.

The answer is the same after editing the question. I am wondering if we probably don’t need to use it and therefore don’t need to know about it in detail.

If you could tell us why you need to use createPlainTextQRCode’s withProperties instead of TextFrame’s or PageItem’s, it might provide some helpful information.