Skip to main content
Known Participant
November 26, 2015
Question

CC Extension, how to get started

  • November 26, 2015
  • 2 replies
  • 1006 views

I want to create a product that will enable exporting from photoshop to a certain custom image format.

Ideally I would like to add a menu item to the "File" menu with an option to export to my custom format, alternatively I would add the format to photoshop's existing formats in the popup menu in "Save as".

I'm trying to evaluate whether writing an extension will enable me to do this but I'm having trouble getting any sample code/tutorial or documentation from Adobe (or any other source) to actually work.

For example, following the instructions here: http://www.adobe.com/devnet/creativesuite/articles/a-short-guide-to-HTML5-extensions.html (and similarly CC_Extension_SDK.pdf)

But the extension was not loaded (AFAIK) and nothing happend.

I later understood that I need to name the extension in a reverse dns fashion and that I need not include the version in the "host" element of the manifest.xml and that the folder name to place the extension in needs to be CEP and not CEPServiceManager4

After these changes the extension was loading but I wasn't able to make any further progress. More specifically, getting the button to trigger a window opening as indicated by the tutorial

1. I've added an "openDocument" function to host/ps.js

var openDocument = function(path) {

  app.open(new File(path));

}

2. I've added "./host/ps.js" as ScriptPath in the manifest

3. I've added these elements to the main html body:

    <script src="js/lib/CSInterface-4.0.0.js"></script>

    <script src="js/main.js"></script>

4. I've added these lines in js/main.js

var csInterface = new CSInterface();

var button = window.document.getElementById("testbutton"); button.onclick = function() {

// Call function defined in host/ps.jsx

               csInterface.evalScript("addDocument()");

               };

Nothing happens when I press the button, no indication of trouble is given, no messages in the console. I'm really lost here and would appreciate some help if any one can give it to me.

I'm an experienced application developer and normally work in C/C++/Objective C and I have little experiance using javascript so I expect a steep learning curve and I'm sure I am unaware of some basic stuff that is trivial to people developing in this evnrionment but I've developed plug-ins and extensions for other products in the past (including Lightroom BTW) and this experiance is leaving me feeling very stupid.

Thanks in advance to anyone who can guide me in the right direction here

Eyal

This topic has been closed for replies.

2 replies

Inspiring
November 27, 2015

I'm not speaking from personal experience, but I think you should probably look into the plugin SDK (Adobe Photoshop SDK | Adobe Developer Connection).

There appears to be a specific category of plugins for handling file formats, and you should be able to use C#/C++.

On the Extendscript side of things, while you can write binary files, it would probably be slow and cumbersome because Extendscript doesn't handily expose raw pixel data from a document as far as I know, you'd have to use workarounds like sampling individual pixels with the eyedropper tool or writing out a raw image file first.

DBarranca
Legend
November 27, 2015

Hi,

I'm currently at about 80% in the process of writing a book titled "Adobe Photoshop HTML Panels Development" (see announce here: http://www.davidebarranca.com/2015/10/announcing-photoshop-html-panels-development-book-project/) - I'll keep the blog updated in the next weeks with some news, so keep an eye on that.

Best,

Davide

---

www.davidebarranca.com

www.cs-extensions.com

BigRedlerAuthor
Known Participant
November 29, 2015

Thanks Davide, Will keep an eye but I hope to be well inside actually writing the produce by the time it goes out.

uberplugins
Inspiring
November 26, 2015

This is not the answer. Just a list of useful resources. But maybe some of this will help you...

HTML Panels Tips by Davide Barranca

CEP5 super mega guide (HTML5 + Node.js) by Andy Hall

HTML Panels Samples by Adobe

Extension builder plugin for Brackets and Sublime Text by David Deraedt

Slack-based community on scripting and panel development for Adobe Photoshop

BigRedlerAuthor
Known Participant
November 29, 2015

Thanks for that! I will look into the resources you've linked to