Copy link to clipboard
Copied
I'm not new to programming (C, C++, etc), but am fairly new to javascript. I successfully wrote a script to toggle a layer's visubility, which was successfful, and then tried the "Hello World" example from "Adobe Photoshop Scripting Guide." Linked it to "Adobe Photoshop CS5 (64 bit) (12.064)" and ran it. The code immediately went into Debug mode at the line"var docRef = app.Documents.add (2, 4);" [which is supposed to create a new document], saying the error is "undefined is not an object." Can't find anything wrong with my code. Anyone else have this problem?
It should be NewDocumentMode.RGB
It might be helpful if you looked at the javascript guide that ships with Photoshop.
Copy link to clipboard
Copied
documents… not Documents lower case 'd'
Copy link to clipboard
Copied
Yes, with ExtendScript all Photoshop DOM properties, methods, and collections start lowercase.
Copy link to clipboard
Copied
Lowercase did the trick. Thank you guys. However, now, I have another issue: what's the problem with the following line of code?
var docRef = app.documents.add (2, 4, 240, "Image", DocumentMode.RGB, DocumentFill.BACKGROUNDCOLOR);
It works up to, and including "Image," but "mode" and "fill" don't want to work.
Copy link to clipboard
Copied
It should be NewDocumentMode.RGB
It might be helpful if you looked at the javascript guide that ships with Photoshop.
Copy link to clipboard
Copied
Thank you Mr. Hale. You've been very helpful.
.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now