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
Copy link to clipboard
Copied