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

Donwgrading UI script from PS CC to PS C6

Explorer ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

Hello everybody.

I created kind of a big script that was working quite well without any dialog box on PS C6. I started implementing dialog box on a computer with PS CC. I was pleased with the result:

01.jpg

But after going back to other computers with PS C6, I cannot run this altered script anymore.

I mean - it runs, but prompts following error:

20180506_131752.jpg

After running Debugger, all I got was "Window layout failed".

Yes - script just terminates on "w.show ();" statement.

The portion of code responsible for UI goes here:

//choosePref is an array containing objects with data, that I didn't include to make it shorter

var w = new Window ('dialog {orientation: "row", alignChildren: [" ", "top"]}',

    "Brytowanie grafiki | Graphic division", undefined, {closeButton: false});

    w.alignChildren = "right";

    var tab = w.add ("tabbedpanel");

    tab.alignChildren = ["fill", "fill"];

    tab.preferredSize = [350,300];

    var panels = [];

    var options = [];

    var ToverlapWithGraphic = "Uzyj laczenia z grafiki | Create overlap from graphic:";

    var TaddScaffolding = "Uzyj znacznikow laczenia    Use merging markers:";

    var Toptimal = "Uzywaj mniejszych brytow, gdy to tylko mozliwe | Use smaller divisions whenever possible:";

    var Toverlap = "Szerokosc overlapu | Graphics' overlap:";

    var Tmerger = "Szerokosc zgrzewu | Width of weld:";

    var TmaximumDivision = "Maksymalna szerokosc brytu | Maximal division width:";

    var TminimumDivision = "Minimalna szerokosc brytu | Minimal division width:";

    var ToptimalDivision = "Szerokosc optymalna minimalnego brytu | Optimal width for leftovers' fixing:";

    var Tsuffix = "Suffix:";

    var Tlines_Distance = "Pionowa odleglosc pomiedzy liniami znacznikow | Vertical distance between markers:";

    var TlineWidth = "Grubosc znacznika | Width of marker:";

    var TlineLongitude = "Szerokosc znacznika | How long is a marker:";

    var Tframe = "Grubosc obrysowania | Width of framing:";

    for (var i = 0; i < choosePref.length; i++) {

      panels.push( tab.add ("tab", undefined, choosePref.name) );

      panels.compareName = choosePref.name;

      panels.alignChildren = "fill";

      options = panels.add ("panel", undefined, "Opcje lokalne | Local options");

      options.alignChildren = ["fill", "fill"];

      options.add("statictext", undefined, Toverlap);

      options.overlap = options.add("edittext", undefined, choosePref.overlap);

      options.add("statictext", undefined, Tmerger);

      options.merger =             options.add("edittext", undefined, choosePref.merger);

      options.add("statictext", undefined, TmaximumDivision);

      options.maximumDivision =    options.add("edittext", undefined, choosePref.maximumDivision);

      options.add("statictext", undefined, TminimumDivision);

      options.minimumDivision =    options.add("edittext", undefined, choosePref.minimumDivision);

      options.add("statictext", undefined, ToptimalDivision);

      options.optimalDivision =    options.add("edittext", undefined, choosePref.optimalDivision);

      options.add("statictext", undefined, Tframe);

      options.frameSize =    options.add("edittext", undefined, choosePref.frameSize);

      options.optimal =            options.add("checkbox", undefined, Toptimal);

                                        options.optimal.value = choosePref.optimal;

                                        options.add("statictext", undefined, Tsuffix);

      options.suffix =             options.add("edittext", undefined, choosePref.suffix);

      options.overlapWithGraphic = options.add("checkbox", undefined, ToverlapWithGraphic);

      options.overlapWithGraphic.value = choosePref.overlapWithGraphic;

      options.add("panel");

      options.addScaffolding =     options.add("checkbox", undefined, TaddScaffolding);

      options.addScaffolding.value = choosePref.addScaffolding;

      options.add("statictext", undefined, Tlines_Distance);

      options.lines_Distance =

      options.add("edittext", undefined, choosePref.lines_Distance);

      options.add("statictext", undefined, TlineWidth);

      options.lineWidth =          options.add("edittext", undefined, choosePref.lineWidth);

      options.add("statictext", undefined, TlineLongitude);

      options.lineLongitude =      options.add("edittext", undefined, choosePref.lineLongitude);

    }

    var tab2 = w.add ("tabbedpanel");

    tab2.alignChildren = ['fill','fill'];

    tab2.preferredSize = [300,700];

    var options2 = tab2.add ("panel", undefined, "Opcje globalne | Global options");

    options2.alignChildren = ['fill','fill'];

    // options2.closing = options2.add("checkbox", undefined, "Zamknij plik po brytowaniu | Close file after division");

    var buttonColor = options2.add ("button", undefined, "Wybierz kolor znacznikow | Choose marker color");

    var colorPanel = options2.add("panel {preferredSize: [500, 10]}", undefined, "Pole koloru");

    colorPanel.graphics.backgroundColor = w.graphics.newBrush (w.graphics.BrushType.SOLID_COLOR, [0.3, 0.3, 0.3]);

    var l_color = greyColorObj;

    buttonColor.onClick = function (){

      app.showColorPicker();

      l_color = app.foregroundColor.cmyk;

      colorPanel.graphics.backgroundColor = colorPanel.graphics.newBrush (w.graphics.BrushType.SOLID_COLOR, [

        mapRGB(app.foregroundColor.rgb.red,0,255,0,1), mapRGB(app.foregroundColor.rgb.green,0,255,0,1),

        mapRGB(app.foregroundColor.rgb.blue,0,255,0,1)]);

    }

    function mapRGB (num, in_min, in_max, out_min, out_max) {

      return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;

    }

    var okButton = options2.add ("iconbutton", undefined, ScriptUI.newImage (File(new File((new File($.fileName)).parent +"/img.png"))));

    var cancelButton = options2.add ("button", undefined, "Anuluj :hot_beverage: Cancel", {name: "cancel"});

var appStarted = false;

var pref;

okButton.onClick = function (){

    ///// -- !!!!!!!!!!! pass values to algorithm !!!!!!!!!!! -- /////

    for (var i = 0; i < choosePref.length; i++) {

      if (tab.selection.compareName.toString() == choosePref.name.toString()) {

        var tempIndex = i;

        pref = {};

          pref.compareName = tab.selection.compareName;

          pref.overlapWithGraphic = options[tempIndex].overlapWithGraphic.value;

          pref.addScaffolding = options[tempIndex].addScaffolding.value;

          pref.overlap = parseFloat(options[tempIndex].overlap.text);

          pref.merger = parseFloat(options[tempIndex].merger.text);

          pref.frameSize = parseFloat(options[tempIndex].frameSize.text);

          pref.maximumDivision = parseFloat(options[tempIndex].maximumDivision.text);

          pref.minimumDivision = parseFloat(options[tempIndex].minimumDivision.text);

          pref.optimalDivision = parseFloat(options[tempIndex].optimalDivision.text);

          pref.optimal = options[tempIndex].optimal.value;

          pref.suffix = options[tempIndex].suffix.text;

          pref.lines_Distance = parseFloat(options[tempIndex].lines_Distance.text);

          pref.lineWidth = parseFloat(options[tempIndex].lineWidth.text);

          pref.lineLongitude = parseFloat(options[tempIndex].lineLongitude.text);

          // pref.closing = options2.closing.value;

          appStarted = true;

          w.close();

      }

    }

}

cancelButton.onClick = function (){

  appStarted = false;

  w.close();

}

w.show ();

If anyone wants to run full script - GitHub - MiloszSzatkowski/Graphic-division-plugin-photoshop

The script divides graphics for printing.

Does anyone have any clue ?

Thank You for ANY help

TOPICS
Actions and scripting

Views

607

Translate

Translate

Report

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

Explorer , May 06, 2018 May 06, 2018

OK - found the culprit.

Double tabbedpanel are not supported in CS6.

Thank You.

Votes

Translate

Translate
Adobe
Explorer ,
May 06, 2018 May 06, 2018

Copy link to clipboard

Copied

OK - found the culprit.

Double tabbedpanel are not supported in CS6.

Thank You.

Votes

Translate

Translate

Report

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 ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

I saw you put icons near the tabbedpanel

:hot_beverage: Cancel

Where can I find them?

or how do they create?

Votes

Translate

Translate

Report

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
Explorer ,
May 08, 2018 May 08, 2018

Copy link to clipboard

Copied

LATEST

Hello, gepettol. There are two types of images you can use - icons and graphic files. The first ones are either adobe's icons or keyboard encoded signs (emojis) - just type keyboard signs in Google. The second ones are .png-s, as in var okButton = options2.add ("iconbutton", undefined, ScriptUI.newImage (File(new File((new File($.fileName)).parent +"/img.png")))); . used in script above. Ascii signs and special keyboard signs are not always supported (even C6 has problems with them), you can use glyphs instead by invoking new font in ScriptUi new Font (), but graphic files do quite well.

Votes

Translate

Translate

Report

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