Any way to define the scripts folder in a binary file?

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

ddbell

Any way to define the scripts folder in a binary file?

Post by ddbell »

I am looking for a way to define the scripts folder and a resource folder in a .jsxbin file. This code works for .jsx. However, it doesn't seem to work in binary for either CS3 or CS4.

Does anyone know of a way to do this in a binary file?

Thanks



Code: Select all
function WhoAmI() {
   var where;
   try {
      var FORCEERROR = FORCERRROR;
   }
   catch( err ) {
      where = File(err.fileName);
   }
   return where;
}
var scriptFolder = new File(WhoAmI()).parent;
function WhoAmI() {
   var where;
   try {
      var FORCEERROR = FORCERRROR;
   }
   catch( err ) {
      where = File(err.fileName);
   }
   return where;
}
var scriptFolder = new File(WhoAmI()).parent;
var resourceFolder = new File(scriptFolder+'/resources');

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Paul MR

Any way to define the scripts folder in a binary file?

Post by Paul MR »

One way of doing it is to use a jsx as a wrapper to pass info to the binary file.
Call the jsx file that does an $.evalFile(File(WhoAmI().parent + "/fileName.jsxbin"));
This way you can pass any vars to the binary file.
Mike Hale

Any way to define the scripts folder in a binary file?

Post by Mike Hale »

Also if your script is in the Adobe scripts folder you can localize the path using this

var scriptsPath = app.path + "/" + localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts");
ddbell

Any way to define the scripts folder in a binary file?

Post by ddbell »

I've been doing the .jsx wrapper already. The thing that I don't like about this is that CS4 will recognize both the .jsx and .jsxbin file in the scripts menu. For this case, I only want the user to have the .jsx file option to run. For CS3 it works out OK because it will only recognize the .jsx file anyway.

What I want to do is put the entire script into one .jsxbin file and rename the extension .jsx. For some reason, it still runs correctly when the extension is renamed and CS3 will recognize the binary file when it is named .jsx instead of .jsxbin.

It looks like what Mike is suggesting will probably work for what I need since the script will be installed into the adobe scripts folder. I'll give that a try.

Thanks