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

**URL:** <https://forums.creativeclouddeveloper.com/t/q-how-to-pass-properties-array-of-string-to-method-e-g-createplaintextqrcode/8514>\
**Category:** InDesign\
**Tags:** javascript, indesign\
**Created:** [October 14, 2024, 4:46am UTC](https://forums.creativeclouddeveloper.com/t/q-how-to-pass-properties-array-of-string-to-method-e-g-createplaintextqrcode/8514 "2024-10-14T04:46:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ritter](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/ritter/32/3957_2.png) [@Ritter](https://forums.creativeclouddeveloper.com/u/Ritter)\
**Post date:** [October 14, 2024, 4:46am UTC](https://forums.creativeclouddeveloper.com/t/q-how-to-pass-properties-array-of-string-to-method-e-g-createplaintextqrcode/8514/1 "2024-10-14T04:46:32Z")

</div>

I am trying to grasp the [InDesign ExtendScript API-Documentation](https://www.indesignjs.de/extendscriptAPI/indesign14/Button.html#d1e131773__d1e134320) but do not understand how to pass **properties** to the method.

The method [createPlainTextQRCode](https://www.indesignjs.de/extendscriptAPI/indesign14/Button.html#d1e131773__d1e134320) 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](https://www.indesignjs.de/extendscriptAPI/indesign14/Button.html#d1e131773__iProps)) 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:

```javascript
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:

```javascript
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.

---

<div class="post-metadata">

**Author:** ![sttk3](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sttk3](https://forums.creativeclouddeveloper.com/u/sttk3)\
**Post date:** [October 14, 2024, 7:44am UTC](https://forums.creativeclouddeveloper.com/t/q-how-to-pass-properties-array-of-string-to-method-e-g-createplaintextqrcode/8514/2 "2024-10-14T07:44:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Ritter](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/ritter/32/3957_2.png) [@Ritter](https://forums.creativeclouddeveloper.com/u/Ritter)\
**Post date:** [October 14, 2024, 8:20am UTC](https://forums.creativeclouddeveloper.com/t/q-how-to-pass-properties-array-of-string-to-method-e-g-createplaintextqrcode/8514/3 "2024-10-14T08:20:24Z")

</div>

@sttk3

I apologize for the confusion. 🙏

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

---

<div class="post-metadata">

**Author:** ![sttk3](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@sttk3](https://forums.creativeclouddeveloper.com/u/sttk3)\
**Post date:** [October 14, 2024, 8:50am UTC](https://forums.creativeclouddeveloper.com/t/q-how-to-pass-properties-array-of-string-to-method-e-g-createplaintextqrcode/8514/4 "2024-10-14T08:50:56Z")

</div>

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.
