Paths on a mac.

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

Moderators: Tom, Kukurykus

myranalis

Paths on a mac.

Post by myranalis »

You guys have helped me out twice now, I'm hoping i can get one more favor. My script is complete and runnin on windows. I've converted to binary forms and written a loader script that looks like:

Code: Select all#target photoshop
app.bringToFront();
/*
<javascriptresource>
<name>Element Sprayer</name>
<about>Spray elements along a path.</about>
<enableinfo>true</enableinfo>
</javascriptresource>
*/
var SCRIPTS_FOLDER =  decodeURI(app.path + '/' + localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts"));
$.evalFile (File(SCRIPTS_FOLDER+ "/MyTest Scripts Only/MyTest.jsx"));

My loader script sits in the preset scripts folder and the real files in the 'MyTest Scripts Only' subfolder. I get a listing in the 'scripts' menu in photoshop on both windows and mac. The script runs perfect on windows. On macs though I get a file not found from the loader.

My only thought is it has something to do with the spaces in the 'MyTest Scripts Only' subfolder name? But if I rename it to sometime without the ' Scripts Only' extension than all the supporting library files show up in the 'scripts' menu which I don't want!

Can someone please point me in the right direction?

Thanks

Anna
xbytor

Paths on a mac.

Post by xbytor »

Try this:

Code: Select allvar scriptFolder = new File($.fileName).parent;
var jsxbinFile = new File(scriptFolder+ "/MyTest Scripts Only/MyTest.jsx");

// if (!jsxbinFile.exists) alert('File not found: ' + jsxbin.absoluteURI);
$.evalFile (jsxbinFile);
myranalis

Paths on a mac.

Post by myranalis »

Thanks for that - that seems to work fine.

A couple of related questions though: is there anyway to pass parameters to the jsxbinFile when using the $.evalFile function? I'd like to be able to turn logging on/off using the loader script if possible.

Also the use of $.fileName or err.fileName don't appear to work as expected when the jsx is a binary. Do you know any way around this? I'm trying to establish a path relative to the script's current location for loading resources...
xbytor

Paths on a mac.

Post by xbytor »

is there anyway to pass parameters to the jsxbinFile when using the $.evalFile function?

Do you know any way around this? I'm trying to establish a path relative to the script's current location for loading resources...

Pass parameters (including the path to the script) in a text file. The launch-script writes the info, the jsxbin reads the info.