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

Need help with trying to execute palette jsxbin files.

Engaged ,
Mar 08, 2020 Mar 08, 2020

Copy link to clipboard

Copied

I've taken the code for executing palette jsxbin files and added code to select the jsxbin file but it doesn't work.

 

Any suggestions?

 

// execJSXBIN.jsx

/**
* @@@BUILDINFO@@@ execJSXBIN.jsx !Version! Sun Mar 08 2020 20:43:03 GMT-0500
*/

var fileObj;
var win = new Window("dialog");
win.text = "Execute JSXBIN 08 Mar 2020";
win.orientation = "column";
win.alignChildren = ["center", "top"];
win.spacing = 10;
win.margins = 16;

// GROUP1
// ======
var group1 = win.add("group", undefined, { name: "group1" });
group1.orientation = "row";
group1.alignChildren = ["left", "center"];
group1.spacing = 10;
group1.margins = 0;

var button1 = group1.add("button", undefined, undefined, { name: "button1" });
button1.text = "Execute JSXBIN";

var button2 = group1.add("button", undefined, undefined, { name: "button2" });
button2.text = "CLOSE";

button1.onClick = function ()
{
    win.close();
    executeJSXBIN();
};

button2.onClick = function ()
{
    win.close();
};

win.show();

function executeJSXBIN()
{

    fileObj = File.openDialog("SELECT THE FILE TO BE PROCESSED .JSXBIN:");

    Decode(fileObj);

    ////////////////////////////////////////////////////////////////////////////////////////////
    function Decode(file)
    {
        try
        {
            if (!file.fsName.match(/\.(JSXBIN|jsxbin)$/i))
            {
                alert("ERROR!!!\nYOU HAVE SELECTED AN INVALID FILE\n\nYOU MUST SELECT ONLY FILES.JSXBIN?");
                return;
            }

            var bridgeTalk = new BridgeTalk();

            var photoShop = BridgeTalk.getSpecifier("photoshop");
            if (!photoShop) photoShop = "photoshop-60.064"; /* only for CS6x64, need redone*/

            bridgeTalk.target = photoShop;

            var jsxbin = "" + fileObj;

            var pth = new File($.fileName).parent.fullName + "/" + jsxbin;

            bridgeTalk.body = "$.evalFile(" + pth.toSource() + ")";
            bridgeTalk.send();

            //alert(" input: " + pth + "\n" + bridgeTalk.body);

            return true;
        }
        catch (e)
        {
            alert(e);
            return false;
        }
    }
}

 

Thanks,

RONC

TOPICS
Actions and scripting , SDK

Views

2.9K

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
Adobe
People's Champ ,
Mar 09, 2020 Mar 09, 2020

Copy link to clipboard

Copied

LATEST
You need to make changes in only one place.
Replace
var dialog, dialogGraphics;
on the
var dialogGraphics;
 

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