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

Tried "Hello World" example, but PS CS5 would not run it

Explorer ,
Mar 19, 2011 Mar 19, 2011

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?

TOPICS
Actions and scripting
726
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

Guru , Mar 19, 2011 Mar 19, 2011

It should be NewDocumentMode.RGB

It might be helpful if you looked at the javascript guide that ships with Photoshop.

Translate
Adobe
Guide ,
Mar 19, 2011 Mar 19, 2011

documents… not Documents lower case 'd'

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 ,
Mar 19, 2011 Mar 19, 2011

Yes, with ExtendScript all Photoshop DOM properties, methods, and collections start lowercase.

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
Explorer ,
Mar 19, 2011 Mar 19, 2011

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.

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 ,
Mar 19, 2011 Mar 19, 2011

It should be NewDocumentMode.RGB

It might be helpful if you looked at the javascript guide that ships with Photoshop.

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
Explorer ,
Mar 19, 2011 Mar 19, 2011
LATEST

Thank you Mr. Hale. You've been very helpful.

.

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