Skip to main content
Known Participant
September 26, 2019
Question

Photoshop CEP panel and user jsx path

  • September 26, 2019
  • 1 reply
  • 2195 views

I'm making a CEP panel in photoshop and i'd like to specify a folder that is not in the extension in which to run scripts.

This is the code im currently using.

 

var csInterface=new CSInterface,gExtensionId="testPanel", event=new CSEvent("com.adobe.PhotoshopPersistent","APPLICATION");


event.extensionId=gExtensionId;csInterface.dispatchEvent(event);

function onLoaded(){
var a=new CSInterface;b=a.hostEnvironment.appName;"FLPR"!=b&&loadJSX();
for(var c=["PHXS"],e=0;e<c.length;e++){var d=c[e];if(0<=b.indexOf(d)&&(d=document.getElementById("btn_"+d)))d.disabled=!1}updateThemeWithAppSkinInfo(a.hostEnvironment.appSkinInfo);
a.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT,onAppThemeColorChanged)}

var extensionRoot=csInterface.getSystemPath(SystemPath.EXTENSION)+"/jsx/scripts/";


function loadJSX()
{
var a=new CSInterface,c=a.getSystemPath(SystemPath.EXTENSION)+"/jsx/";
a.evalScript('$._ext.evalFiles("'+c+'")')}

function evalScript(a,c){(new CSInterface).evalScript(a,c)}
function openUrl(a){csInterface.openURLInDefaultBrowser(a)}

 

$(document).ready(function(){loadJSX();

$("#1d-1").button().click(function(a){csInterface.evalScript('$._ext.evalFile("'+extensionRoot+'1d-1.jsx")')});

 

 

I don't understand every line of it but it does work.

 

As well as having the /jsx/ folder in the extension i'd like to use other path.

The user folder.

/user/Creative\ Cloud\ files/folder1/jsx

 

 

This topic has been closed for replies.

1 reply

Ten A
Community Expert
Community Expert
September 27, 2019

if you want to put scripts under the Creative Cloud folder, Your path is "/users/<USER_NAME>/Creative Cloud Files/folder1/jsx".
You can get user's Document folders path and remove Document like below snipet.

csi.getSystemPath(SystemPath.MY_DOCUMENTS).match(/(.+)(Documents)/);
alert(RegExp.$1+"Creative Cloud files/folder1/jsx");

ex.

USER_DATA userData (/users/Library/Application Support)
COMMON_FILES commonFiles (/Library/Application Support)
MY_DOCUMENTS myDocuments (/users/<USER_NAME>/Documents)
APPLICATION application (/Library/Application Support/Adobe/CEP/Extensions/<EXT_NAME>)
EXTENSION extension (/Library/Application Support/Adobe/CEP/Extensions/<EXT_NAME>)
HOST_APPLICATION hostApplication (HOST_APPS_PATH)

These are SystemPath's parameters you can use.

Known Participant
September 27, 2019

Thanks for that.