Code Monkey home page Code Monkey logo

getting-started-guides's Introduction

Getting Started with CEP Extensions

CEP (Common Extensibility Platform) lets you build extensions in Adobe Creative Cloud applications like Photoshop, Illustrator, InDesign, After Effects, and many more. Extensions built with CEP let users customize their Creative Cloud experience for their unique workflows.

In this guide, we will help you quickly get started building a CEP extension by covering the basics in 6 easy steps.

By the end of this guide, we will have a CEP extension that opens a new document from the user's local folder.

Example extension: opening a new file in Photoshop

When you're finished, be sure to check out the Next Steps section, which has links to guides and samples that will walk you through debugging as well as some common intermediate and advanced topics, like exporting files from the host app, making network requests, and more.

Contents

Technology Used

Prerequisites

Basic knowledge of HTML, CSS, and JavaScript.

Development Steps

1. Decide the folder structure

You will need to decide where to save your extension code first. Your extension can be saved either at the root level or at the user level, depending on who’s allowed to use the extension (refer to CEP 8 HTML Extension Cookbook for the actual paths).

Except for the required CSXS folder, which must contain manifest.xml, the folder structure is flexible. One recommended way to structure the folders would be:

Extension structure

  • /CSXS -- contains the manifest.xml file, which stores the extension configuration data. As noted above, this is a requirement for your extension to show up in the host app.

  • /client -- contains the front-end HTML, JavaScript, and CSS code, as well as the required Adobe CSInterface.js library, and any third-party libraries you might want to include (for example, jQuery).

  • /host -- contains any ExtendScript files (in this case, index.jsx) for your extension. These are used to access and drive most features in the host app

This structure allows you to achieve a clear separation of concerns by devoting one folder to each, client-side and host app.

2. Configure Your Extension in manifest.xml

There are many possible configurations for this file, but to keep things simple, let’s focus on the minimum requirements (for more, see the complete version of the manifest, available in the CEP Resources Github repo).

For a minimal setup, let's look at the following XML elements and attributes in manifest.xml. See the corresponding comments (#1-7) in the code that follows:

  1. ExtensionBundleId: A unique bundle ID you assign to your extension like com.my.test
  2. Extension Id: A unique ID you assign to your extension. It usually follows this syntax: ExtensionBundleID + .panel = com.my.test.panel (note that this ID appears twice in the manifest)
  3. Host Name & Version: List of host application IDs and versions that your extension is built to support. To learn more, take a look at the Adobe CEP HTML Extension Cookbook
  4. MainPath: Path to your index.html. Make sure the path to this file is from the top level directory of your code base
  5. ScriptPath: Path to your index.jsx. Make sure the path to this file is from the top level directory of your code base
  6. Menu: Your extension name that will appear in the dropdown menu of the host app(s)
  7. Size: Default size of your extension
<?xml version='1.0' encoding='UTF-8'?>
<!-- 1) -->
<ExtensionManifest ExtensionBundleId="com.my.test" ExtensionBundleVersion="1.0.0" Version="7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ExtensionList>
    <!-- 2) -->
    <Extension Id="com.my.test.panel" Version="1.0.0" />
  </ExtensionList>
  <ExecutionEnvironment>
    <HostList>
      <!-- 3) -->
      <Host Name="PHSP" Version="19" />
      <Host Name="PHXS" Version="19" />
    </HostList>
    <LocaleList>
      <Locale Code="All" />
    </LocaleList>
    <RequiredRuntimeList>
      <RequiredRuntime Name="CSXS" Version="7.0" />
    </RequiredRuntimeList>
  </ExecutionEnvironment>
  <DispatchInfoList>
    <!-- 2) -->
    <Extension Id="com.my.test.panel">
      <DispatchInfo>
        <Resources>
          <!-- 4) -->
          <MainPath>./client/index.html</MainPath>
          <!-- 5) -->
          <ScriptPath>./host/index.jsx</ScriptPath>
          <CEFCommandLine />
        </Resources>
        <Lifecycle>
          <AutoVisible>true</AutoVisible>
        </Lifecycle>
        <UI>
          <Type>Panel</Type>
          <!-- 6) -->
          <Menu>My First Panel</Menu>
          <Geometry>
            <Size>
              <!-- 7) -->
              <Height>500</Height>
              <Width>350</Width>
            </Size>
          </Geometry>
          <Icons />
        </UI>
      </DispatchInfo>
    </Extension>
  </DispatchInfoList>
</ExtensionManifest>

This particular configuration gives an panel-type extension called "My First Panel" that supports Photoshop v19 and shows at 500px x 350px.

3. Download CSInterface.js

You need to download the latest version of CEP's CSInterface.js library, which enables you to control the extension and communicate with the application.

You can include this library wherever you like within your codebase, as long as you include it as a <script> dependency in your index.html file.

If you're following along with this example, place the downloaded CSInterface.js directly under /client.

4. Write Your Front-end Code

Now, it’s time for you to start using your web development skills to build your extension. You can build this out with HTML, CSS, and JavaScript to suit your goals, but let’s have a look at the basic files.

Create HTML Markup

The user interface for CEP extensions is written in HTML. For this example, locate the HTML document at /client/index.html and write the following code (see comments #1-3):

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Your First Panel</title>
</head>
<body>
    <!-- 1) Simple HTML UI elements to get us started -->
    <h1>Your first panel</h1>

    <!-- 2) A button -->
    <button id="open-button">Open</button>

    <!-- 3) Add your script dependencies here, including CEP's CSInterface.js library -->
    <script type="text/javascript" src="CSInterface.js"></script>
    <script type="text/javascript" src="index.js"></script>
</body>
</html>

As can been seen in the code above, the CSInterface.js library is included as a <script> dependency in this index.html file.

Write Your JavaScript Code

Make sure to create an instance of CSInterface. Your CSInterface instance will give you access to methods and properties useful for buildling your extension.

One of those methods, evalScript(), will let you communicate from your client-side JavaScript to your ExtendScript code (ExtendScript is covered in the next section) and back. See comments #1-3:

/* 1) Create an instance of CSInterface. */
var csInterface = new CSInterface();

/* 2) Make a reference to your HTML button and add a click handler. */
var openButton = document.querySelector("#open-button");
openButton.addEventListener("click", openDoc);

/* 3) Write a helper function to pass instructions to the ExtendScript side. */
function openDoc() {
  csInterface.evalScript("openDocument()");
}

Feel free to refer to the CEP Github repo if you are curious about what else you can do with CSInterface.

5. Write Your ExtendScript Code

ExtendScript code is different from your client-side JavaScript in that, via ExtendScript, you can access the host application’s functionalities, such as opening a document, editing it, exporting it, and almost anything else the host application can do.

In this example, we will create a function that opens one file in the host application. Make sure to change the file name and the path to a file that actually exists in your filesystem.

function openDocument(){
  var fileRef = new File("~/Downloads/myFile.jpg");
  var docRef = app.open(fileRef);
}

This openDocument() helper function will be called when csInterface.evalScript("openDocument()") is invoked from your client-side JavaScript file.

6. Launch your extension in the host app

Where the user can find and open your extension will depend on the Creative Cloud host app that your extension supports.

Since the sample extension we made in this guide supports Photoshop, you can find the extension under:

Window > Extensions > My First Panel

When you try to launch your extension, if you get an alert about unsigned extensions, see the "Set the Debug Mode" section of our Client-side debugging guide.

Next Steps

Now that you've seen the basics, check out these guides and samples that walk you through some common intermediate and advanced topics in CEP:

Other Resources

getting-started-guides's People

Contributors

akshay-abrol avatar ashryanbeats avatar cc-repo-watcher avatar dkstevekwak avatar erinfinnegan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

getting-started-guides's Issues

Mistake in the tutorial: Client-side debugging

Here is the error:
image
Instead of this

<Host Name="PHXS" Port="8088"/>
<Host Name="PHSP" Port="8088"/>

It should be like this:

<Host Name="PHXS" Port="8088"/>
<Host Name="PHSP" Port="8089"/>

File Operation Error when installing .zxp for Illustrator on Mac

Submit an issue

Topic

This is an issue regarding:

  • The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s):

Description of the issue

Hi! I'm trying to package and install an extension with an accompanying plugin for Illustrator. I can't seem to wrap my head around how to properly package everything as a .zxp file. I'm trying to follow along with the examples but I have run into some questions. I'll walk through the process below.

Right now I'm just trying to get the extension to properly install itself into the CEP/extensions folder on mac. From what I gather in the examples, the complete extension folder (where the CSXS/manifest.xml is located) should be packaged using the ZXPSignCmd tool into a single extension.zxp file. There's a few questions I have here:

  • Is this correct?
  • Is it also correct that the .mxi file is not necessary here?
  • When I try to install this .zxp file directly after packaging it, I get a success message but the extension is not present in the CEP/extensions folder (checked both the common and user libraries). Is this the expected behaviour? If yes, where is the extension installation location?

After packaging the extension, I want to bundle it together with the plugin.aip file which it depends on. To do this, I understand that you have to bundle everything into a common folder that looks something like this:

Product/
|__Extension/
   |__extension.zxp
|__Plugin/
   |__plugin.aip
|__id.mxi

where the id.mxi specifies where the contents should go. Is this correct?

I tried to keep the contents of the .mxi file similar to the examples. This is the entire file:

<?xml version="1.0" encoding="UTF-8"?>
<macromedia-extension 
	id="example"
	name="example"
	requires-restart="false"
	version="1.0.0">
 
	<author name="AKE"/>
 
	<description>
        <![CDATA[<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><p>some text</p>]]>
	</description>
 
	 <ui-access>
		<![CDATA[You can run this extension by choosing<br>
        <p>Run the extension!</p>]]>
	</ui-access>
 
	<license-agreement>
		<![CDATA[You are about to install an Extension.]]>
	</license-agreement>
 
	<products>
		<product familyname="Illustrator" version="27"/>
	</products>
 
	<files>
		<file source="Extension/extension.zxp"
			  destination=""
			  file-type="CSXS"
			  products="Illustrator"
			  minVersion="27.0" />

		<file source="Plugin/plugin.aip"
			  destination="$installfolder/Plug-ins"
			  file-type="plugin"
			  products="Illustrator"
			  minVersion="27.0" />
	</files>
</macromedia-extension>

I use the ZXPSignCmd to package everything together.

When trying to install this with the ExManCmd CLI I just get the cryptic error Failed to install, status = -164! back. I understand from this resource that there's probably something wrong with the files part, but I need help understanding what. Some additional questions/notes:

  • Is the destination="$installfolder/Plug-ins" part correct usage of the path tokens? Is this the best way to install an accompanying .aip plugin for the user?
  • I have tried commenting out the entire plugin part of the .mxi and deleting the files prior to signing. When the plugin part is included, the error is Failed to install, status = -160!. When it isn't, the error is the Failed to install, status = -164! reported earlier.
  • The signing tool seems to create META-INF folders in the input folders, what are those? Are they just artifacts or are they used for something?
  • This one is a little bit off topic: Where do you get the ID for the plugin? On this page the ID is "[...] assigned by Adobe when you submit your extension." But from what I've read you need a valid package to be able to submit the .zxp package, which seems to create a catch-22 situation.

I know there's a lot of questions here, I hope that's fine. I greatly appreciate any help, reading recommendations or other helpful resources/advice to help me complete this :)

Thank you!
Alfred

Empty console with error while trying to debug CEP extension

Submit an issue

Topic

This is an issue regarding:

  • The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s): Photoshop 21.1

Description of the issue

Empty console with error while trying to debug CEP extension.

image

Proposed solution or attempted solutions that failed

SDK_Invert_ProcAmp Doesn't Build on Xcode 13

Submit an issue

Topic

SDK_Invert_ProcAmp Doesn't Build on Xcode 13

Versions

This is an issue regarding the AE-SDK on Mac
image

image

image

Description of the issue

image

Proposed solution or attempted solutions that failed

Forum said to install Xcode 9. Xcode 9 doesn't work on my new Mac.

Questions & Statements

  • How can I learn how to build a metal plugin when Adobe's own example won't compile.
  • I know this is probably not the right place to address this issue but Adobe gives me ZERO outlet to post the issue
  • The Issue has been known since 2019 when reported on the forum
  • Adobe needs better support for plugin developers if they want people to build things for their applications

License review

Submit an issue

Topic

This is an issue regarding:

  • The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s): any

Description of the issue

@stevengill in light of the discussion on this pull request for the Samples repo, should we look at updating the license on this one as well?

Link to English Version of Indesign Scripting Guide

Submit an issue

Topic

This is an issue regarding:

  • The guides contained within this repo.
  • The samples contained within this repo.

Description of the issue

Nihongo ga wakarimasu ka? (Do you understand Japanese?)

In Other Resources, the link for Indesign Scripting guide points to Japanese version of the documentation.

https://github.com/Adobe-CEP/Getting-Started-guides#other-resources

Proposed solution or attempted solutions that failed

Please edit to point to English document link

https://wwwimages2.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/scripting/InDesign_ScriptingGuide_JS.pdf

My First Panel extension - Need Help

  1. I have followed the "6 steps" to create an CEP extension for illustrator 2023.
  2. The zip for "My First Panel" is attached
  3. The folder resides inside the following path
    image
  4. Inside Illustrator, I can see it being added to Window > Extensions> My First Panel as shown below
    image

But when "My First Panel" is clicked" --> It is empty!!!
image

Am I missing something. Please reveiw the attached zip and let me know.

My First Panel.zip

  1. Similarly, I tried UISamples which is provided as CEP samples, but I am facing the same problem. In the images above, you can see that UI samples menu is also available

Thanks in advance for help!
RD

Step 6 is lacking details

"6. Launch your extension in the host app"

This section is lacking the how part. How does one launch the extension?

"Package Distribute Install" does walk through the process of generating a signed zxp however I feel like this guid is eluding to a method which is not described here. Is there a way to load the extension without going through the zxp/install process for developing?

"Client-side debugging" also feels like there is a way to run an unsigned zxp easily but also fails to detail how one does it.

openDocument() does not execute when clicking on the 'Open' button for the "Getting Started with CEP Extensions" example.

Submit an issue

Topic

This is an issue regarding:

  • The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s):

Getting Started with CEP Extensions

CEP 9.0
Photoshop 2020 (21.0.2)
MacOS 10.14.6

Description of the issue

I followed the instructions on the "Getting Started with CEP Extensions" page and a it did create an extension in Photoshop. When I click the "Open" button, nothing happens. I modified the index.jsx file and tested it from ExtendScript Toolkit and it did open the myFile.jpg in Photoshop.

openDocument();

function openDocument(){
var fileRef = new File("~/Downloads/myFile.jpg");
var docRef = app.open(fileRef);
}

So the problem seems to be that clicking the Open button on the extension panel cannot execute the openDocument function from the .jsx file.

Proposed solution or attempted solutions that failed

Unable to install a self-signed CEP extension using ExManCmd.exe.

Topic

This is an issue regarding:

  • The guides contained within this repo.

Versions

  • ZXPSignCmd 4.1.1
  • ExManCmd: downloaded from this page.
  • CEP 8
  • Photoshop CC 2018
  • Windows 7/10

Description of the issue

Installing a self-signed ZXP extension using command line command:

E:\Desktop\ExManCmd_win\ExManCmd.exe /install CepTest01.zxp

But it returns the following error:

Installing extension with file path = CepTest01.zxp
Failed to install, status = -402!

Proposed solution or attempted solutions that failed

Resigned and confirmed there is not any error reported when packaging the extension using ZXPSignCmd.

The certificate used and the self-signed CEP extension are attached.
certf_ext.zip

About Premiere Pro Scripting Guide

Submit an issue

Topic

This is an issue regarding:

  • The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s):

Description of the issue

about:app.project.sequences[index].audioTracks[index].clips[index].outPoint
Clips Can only be lengthened, not shortened

Proposed solution or attempted solutions that failed

Replace ExManCmd with UPIA

Submit an issue

Topic

This is an issue regarding:

  • [ x ] The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s):

Description of the issue

The Package, Distribute, Install Guide needs to replace ExManCmd with UPIA.

Proposed solution or attempted solutions that failed

How to keep devtools connected after reloading my extension

Submit an issue

Topic

This is an issue regarding:

  • The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]: 9.x
  • Supported CC app(s) and version(s): Photoshop 22 (using legacy extensions)

Description of the issue

I'm working on a CEP extension and I have a question about debug workflows. I've followed the "Client-side debugging" doc, and everything is working as expected.
https://github.com/Adobe-CEP/Getting-Started-guides/tree/master/Client-side%20Debugging#debugging-in-chrome

However, when I make a change to the extension and disable/re-enable it in the CC app to see my changes, my devtools connection is severed and I'm shown this message: "Debugging connection was closed. Reason: WebSocket disconnected". Then I have to go back to the previous page and click the link for my extension again.

Is there a workaround for this issue that would prevent my session from being disconnected every time I reload the extension? Or perhaps there's a way to reload the extension that doesn't involve disabling/re-enabling it within the CC app?

Thanks!

Proposed solution or attempted solutions that failed

n/a

Getting Started Guide is not clear about project files should be created / copied for debugging.

Submit an issue

Topic

This is an issue regarding:

  • The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s):

Description of the issue

The getting started guide section "Launch your extension in the host app" did not have information on where to put the project files for debugging, and the information was not contained in any other area regarding the setup of the project,

Proposed solution or attempted solutions that failed

This section should include information regarding where the project files should be copied in order to test in the host application. For instance, on Windows I believe the folder is C:\Program Files\Common Files\Adobe\CEP\extensions

Mention last version of PS to support CEP

Submit an issue

Topic

This is an issue regarding:

  • [ x] The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s):

Description of the issue

Proposed solution or attempted solutions that failed

Extension won't show up in menu

This is an issue regarding the guides contained within this repo.

Getting Started with CEP Extensions part 5. Write Your ExtendScript Code lacks some info.
Where does function openDocument() go? I assume it goes to host/index.jsx.

After following guide by letter and putting everything to C:\Program Files (x86)\Common Files\Adobe\CEP\extensions\com.my.panel, extension doesn't show up under Window > Extensions

Latest Ps CC
Win10 (x64)

Issue in manifest with the version of CSXS

Submit an issue

Topic

This is an issue regarding:

  • The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s):

Description of the issue

The version of the applications Photoshop Integrated with CEP and the version of CSXS doesn't match.

  <ExecutionEnvironment>
    <HostList>
      <!-- 3) -->
      <Host Name="PHSP" Version="19" />
      <Host Name="PHXS" Version="19" />
    </HostList>
    <LocaleList>
      <Locale Code="All" />
    </LocaleList>
    <RequiredRuntimeList>
      <RequiredRuntime Name="CSXS" Version="7.0" />
    </RequiredRuntimeList>
  </ExecutionEnvironment>

Proposed solution or attempted solutions that failed

Use the version 8 of CSXS or 18 of PHSP/PHXS as you can see in the CEP 8 HTML Extension Cookbook

Update Guide to use Illustrator examples instead of Photoshop

Submit an issue

Topic

Since Photoshop on the M1 no longer supports CEP, we should update this guide with non-Photoshop examples.

Also, we should update it to CEP 12, as the current guide is still using CEP 8.

This is an issue regarding:

  • [ x ] The guides contained within this repo.
  • The samples contained within this repo.

Versions

  • CEP version(s) used [must be 8.x+ for this repo]:
  • Supported CC app(s) and version(s):

Description of the issue

Proposed solution or attempted solutions that failed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.