0

I have written a couple of simple .JSX scripts that automate some common monkeywork I do in Photoshop.

I wrote the scripts in ExtendScriptToolkit and then execute them with File > Scripts > Browse and select the script I want. This runs the script and does what I want it to but it also launches ExtendScriptToolkit again each time. I have passed the script to a few others at work and they have all asked me to fix this so that the script executes purely within Photoshop but I can't make it work.

Basically, how can I run the script from Photoshop without it launching the script editor as well?

Cheers in advance for your help

popClingwrap
  • 3,919
  • 5
  • 26
  • 44

2 Answers2

1

Check your script for $.writeln() statements. This could be a problem. You can also suppress debugging by setting the debug level.

Taken from the Object Model Viewer in ESTK

// $.level   
// Data Type: number 
// Core JavaScript Classes 
// The current debugging level, which enables or disables the JavaScript debugger.
// One of 0 (no debugging), 1 (break on runtime errors), or 2 (full debug mode).

$.level = 0; 
$.writeln("something");
alert("Hello World");

Edit:
I tried the debug level with the script above. It still opens the ESTK :-( Looks like it does not work. Can anybody confirm this?

fabianmoronzirfas
  • 4,091
  • 4
  • 24
  • 41
  • 1
    Level doesn't work for me on Win7 CS3 or CS5. writeln always brings up the ESTK. I always make sure to remove all writeln statement before I publish a script to production... – Anna Forrest Nov 22 '14 at 15:14
  • I'd removed all the writln statements from my main script but left one in one of the little util scripts that just wrote a blank line so I completely missed it. Removed this and it is working now cheers. – popClingwrap Nov 24 '14 at 09:42
  • I always add a global variable called DEBUG and than add `if(DEBUG) $.writeln()` works fine for me. – fabianmoronzirfas Nov 24 '14 at 13:15
0

$.level = 0;

"The current debugging level, which enables or disables the JavaScript debugger. Read only." Page 217

But when script run from ESTK $.level == 1

When from APP $.level == 0

Аnd solution may be if ($.level) $.writeln("JSC");

mike
  • 1