Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to comment out in a Window resource String

Advocate ,
Jul 12, 2016 Jul 12, 2016

Hi,

say that I have:

var str = "dialog { \

    btn1: Button { text: 'clickMe 1' },\

    btn2: Button { text: 'clickMe 2' }\

}"

var w = new Window(str)

w.show();

which gives a dummy ScriptUI Window of type 'dialog'.

DB 2016-07-12 at 14.49.52.png

I'd like to comment out a part of that resource String, say the btn1 line. How do I do?

Inline... I'd say it's not possible, so I've tried

// they don't work 😕

w.btn1 = null; // or undefined

delete w.btn1;

To no avail. I cannot use

w.btn1.visible = false;

because the element, still, will occupy his own Window real estate even if it's invisible:

DB 2016-07-12 at 14.50.09.png

While what I'm after is a way to comment out the element so that the result is:

DB 2016-07-12 at 14.50.25.png

Basically I've quite complex resource strings that I don't want to mess up when I experiment. I could duplicate the entire code, but I'm curious to see whether there are smarter options.

Suggestions are really appreciated 🙂

Thank you!

Davide Barranca

---

Photoshop HTML Panels Development course

hyyp://htmlpanelsbook.com

TOPICS
Actions and scripting
311
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Jul 12, 2016 Jul 12, 2016

Ciao Davide,

This seems to work for me in Photoshop CS4 Mac OS X:

var str = "dialog { btn1: Button { text: 'clickMe 1' }, btn2: Button { text: 'clickMe 2' } }"

var w = new Window (str)

w.remove (w.btn1)

w.show ();

or:

var str = "dialog { btn1: Button { text: 'clickMe 1' }, btn2: Button { text: 'clickMe 2' } }"

var w = new Window (str)

w.remove ("btn1")

w.show ();

or:

var str = "dialog { btn1: Button { text: 'clickMe 1' }, btn2: Button { text: 'clickMe 2' } }"

var w = new Window (str)

w.remove (0)

w.show ();

Fro

...
Translate
Adobe
Guest
Jul 12, 2016 Jul 12, 2016

Ciao Davide,

This seems to work for me in Photoshop CS4 Mac OS X:

var str = "dialog { btn1: Button { text: 'clickMe 1' }, btn2: Button { text: 'clickMe 2' } }"

var w = new Window (str)

w.remove (w.btn1)

w.show ();

or:

var str = "dialog { btn1: Button { text: 'clickMe 1' }, btn2: Button { text: 'clickMe 2' } }"

var w = new Window (str)

w.remove ("btn1")

w.show ();

or:

var str = "dialog { btn1: Button { text: 'clickMe 1' }, btn2: Button { text: 'clickMe 2' } }"

var w = new Window (str)

w.remove (0)

w.show ();

From https://www.adobe.com/content/dam/Adobe/en/devnet/scripting/pdfs/javascript_tools_guide.pd f :

Capture d’écran 2016-07-12 à 16.44.19.png

HTH,

     --Michel

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 12, 2016 Jul 12, 2016
LATEST

Gee, it was in the documentation; what a silly old boy I've become 🙂

Thank you very much Michel!

Davide

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines