Skip to main content
Known Participant
June 20, 2013
Answered

photoshop scripting output

  • June 20, 2013
  • 2 replies
  • 11825 views

Is there a console or log for output from script events?  I tried making a function, which executes an alert correctly, but doesn't create a new document.  I can't find any way to see if this syntax is wrong or the command is just outdated. 

In the code below, for example, I see the alert message, but no new document.  I don't see anyway to see what's wrong with it and I pulled that line straight from the photoshop scripting guide. 

var createDocument = function() {

    alert("creating new doc!");

    app.documents.add(2,4);

};

This topic has been closed for replies.
Correct answer pixxxelschubser

So you only get output if you're running your script through ESTK?  There's no script output in photoshop itself like Maya, Mudbox, Mari, 3DS Max, Houdini, etc. where you can see what's being run and where it's erroring? 

I'm running this inside of a panel created by Adobe Configurator. 


IMHO I do not think so. (I do not need that.)

Maybe I understand you wrong only.

The only thing you could do - show own messages they even close again by itself.

Something like this:

// CreateNewDocAndShowMessage.jsx

// http://forums.adobe.com/thread/1237214?tstart=0

// regards pixxxelschubser

var Call;

createDocument ();

function createDocument () {

    Call = "creating new doc!";

    CallFunction ();

    app.documents.add (40,40);

    }

function CallFunction () {

    win = new Window ("palette");

    win.someMessage= win.add ("statictext", undefined, Call);

    win.show();

    $.sleep(1500);

    win.close();

}

2 replies

pixxxelschubser
Community Expert
Community Expert
June 20, 2013

Try this:

var NewDocument;

createDocument ();

alert (NewDocument);

function createDocument () {

    alert("creating new doc!");

    app.documents.add (40,40);

    NewDocument = app.activeDocument;

    return NewDocument;

    }

Have fun

Known Participant
June 20, 2013

Thanks, guys.  I appreciate the feedback.  I realize alert is a blocking call and creates a modal window.  I'll look into why it isn't working based on your suggestions, but my bigger question was the existence of a javascript console/log so I could see ANY errors that happen in the future.  Thanks. 

pixxxelschubser
Community Expert
Community Expert
June 20, 2013

Why you don't use $.writeln instead?

var NewDocument;

createDocument ();

$.writeln (NewDocument);

function createDocument () {

    $.writeln ("creating new doc!");

    app.documents.add (40,40);

    NewDocument = app.activeDocument;

    return NewDocument;

    }

Inspiring
June 20, 2013

Your alert is a modal dialog and will stop the rest of the script executing until its dismissed…

app.documents.add(2,4);

works just fine…