Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

photoshop scripting output

Community Beginner ,
Jun 19, 2013 Jun 19, 2013

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);

};

TOPICS
Actions and scripting
11.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 20, 2013 Jun 20, 2013

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.som

...
Translate
Adobe
Guru ,
Jun 20, 2013 Jun 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…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2013 Jun 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 20, 2013 Jun 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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2013 Jun 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;

    }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 20, 2013 Jun 20, 2013

I can certainly give that a try!  Where is that outputted to? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2013 Jun 20, 2013

Hmmh?

strattonbrazil wrote:

… but my bigger question was the existence of a javascript console …

The output you get in ESTK (ExtendScript Toolkit) in the javascript console.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 20, 2013 Jun 20, 2013

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2013 Jun 20, 2013

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();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 23, 2013 Jun 23, 2013

Everything I've tried seems to have to effect besides showing the actual alert messages.  It's like panels' javascript don't have access to the documents or something.  Neither one of these commands seems to do anything and it's frustrating any progress without knowing what the problem is. 

    app.documents.add (40,40);

    app.documents(0).artLayers.add();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 24, 2013 Jun 24, 2013

It's only a wrong syntax.

version 1:

app.documents.add (40,40);

var a = documents.length -1;

app.documents.artLayers.add();

version 2:

app.documents.add (40,40);
activeDocument.artLayers.add();

By the way: the "footer" in ESTK shows you mostly the reason of mistakes.

Have fun

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 24, 2013 Jun 24, 2013

Can you work on configurator panels in ESTK? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Jun 24, 2013 Jun 24, 2013

Because documents.add() returns a reference to the newly created document you could do this.


var a = app.documents.add (40,40);

a.artLayers.add();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 24, 2013 Jun 24, 2013

Has anyone been able to create a document from a Adobe-configurator-created panel HTML event?  I guess that's a bigger question.  If no one else can do that, I'm wasting my time with the output.  That seems to be my experience, but I don't know why scripts in html wouldn't have access to the app besides some strange namespacing issue or running in a separate VM or something. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 24, 2013 Jun 24, 2013

@Michael L Hale,

This is definitely correct. But I do not even know what the TO really wants.

@strattonbrazil

HTML event???

I think my English is too bad to follow you. Also, I can not use the Adobe-configurator or panels with CS3

I'm out then

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 24, 2013 Jun 24, 2013

Hrmm, well, besides ESTK the answer appears to be no.  Thanks, guys. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2015 Jan 27, 2015
LATEST

This is a random comment and not intended to be offensive, but you used "IMHO" a couple times incorrectly and you might want to know.  IMHO or "in my humble opinion" refers to personal opinion and not a statement of fact. This person is asking for some sort of console output instruction, so if you don't know the fact use AFAIK - "As far as I know".  So you could say "AFAIK there isn't a better way to get debug messages in photoshop directly, IMHO you don't them and should do ~whatever else~ instead.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines