Skip to content
Using the Adobe Premiere Extension mechanism, this project provides a framework to trigger your own Premiere CEP functions from outside of Premiere, e.g. from AutoHotkey.
JavaScript HTML Other
Branch: master
Clone or download

Latest commit

Latest commit a8b1d5a Mar 22, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CSXS
client Added swagger documentation and interactive web ui. Apr 28, 2019
host
.debug
.gitignore Working version 1. Oct 1, 2018
readme.md
sample.ahk

readme.md

AHK to Premiere CEP

Using the Adobe Premiere Extension mechanism, this project provides a framework to trigger your own Premiere CEP functions from outside of Premiere, e.g. from AutoHotkey. This is achieved by using a RESTful-like service, started inside Premiere on your localhost. Every custom function can then be triggerd using a local http request.

Let's take a custom function like locking a video track inside of Premiere. Without CEP, you have to use image recognition or similar techniques. With CEP, you can define your own javascript function using extendscript:

function lockVideoLayer(layerNumber) {
    // ...
}

Using this framework, you can now easily trigger this function from outside of premiere with a http request. The required REST-like endpoint is generated automaticaly. In this case, e.g.:

$ curl "http://localhost:8081/lockVideoLayer?layerNumber=3"

Of course, you can also embed this line of code in a AHK-script. Sounds interesting? Let's get started!

Getting started

This short guide will show how to install and use the AHK2PremiereCEP-Framework.

  1. Start by cloning or downloading this repository. There is a ready-to-use-version available.

    Please note: This project uses npm to manage dependencies like the express web server. Don't forget to run npm install on the console inside the client folder. For more information, head over to https://nodejs.org/

  2. Follow this documentation to install the extension. Basicaly, you have to:

    1. Use regedit to allow the execution of unsigned Adobe Premiere extensions.
    2. Copy the downloaded code inside of an extension folder, described here. E.g. C:\Program Files (x86)\Common Files\Adobe\CEP\extensions\AHK2PremiereCEP.
    3. (Re) start Premiere.
  3. Now, you should see the Framework under Window -> Extensions. If there is no entry, you might recheck the documentation and compare your premiere version / setup with the manifest.xml- file, located inside the CSXS- folder.

  4. Double click the extension window. This should open the plugins host- folder with a file named index.jsx in it. Here, you can define your own CEP functions. Please stick to the format already used to ensure correct parsing and server setup from the framework-side. You have to reopen the extension to load any changes. A semi-minimal index.jsx-file looks like this:

    var host = {
        kill: function () {
            // This method is only there for debugging purposes.
        },
        yourNewFunction: function(param1, param2) {
            alert(param1 + " " + param2);
        } // etc.
    }
    

    In newer versions there will be more code inside of the JSX-File. You can ignore or simply delete it, I just upload my very own functions to this repository!

Using AutoHotkey

Now, you are ready to connect your own Premiere CEP functions, defined in the index.jsx-file to autohotkey. Test the REST-like endpoints in the browser of your choice, as shown above. E.g. use chrome and the url:

http://localhost:8081/yourNewFunction?param1=Hello&param2=World

On Windows 10, you can easily trigger this URL using the curl-functionality. AHK-Code wrapping this line would look like this:

F11::
	Run curl ""http://localhost:8081/yourNewFunction?param1=Hello&param2=World"",,hide
	return

Quite easy, isn't it? Of course, you can change the port on your localhost. Have a look at the index.html- file for this.

Development Workflow

Although, this framework enables faster integration of new, custom made CEP functions, the development workflow isn't that great. Here is my workflow for easy debugging:

  1. Start developing your new function using the Adobe ExtendScript Toolkit. Just specify Adobe Premiere CC as targed and you're ready to go with your own javascript CEP code.
  2. After finishing with the development and testing of your new function, copy & paste the code inside the index.jsx-file. Then, reopen the extension and test it again using a browser, as shown above.
  3. You might use derkalaenders CEPReloader for easier reopening of extensions. It speeds up the workflow quite a bit. The kill - function, shown above, does only exist for this integration. If you don't want to use the reloader-extension, you can delete the kill-functionality inside of the framework.
  4. Last but not least, these extensions enables debugging by default. Using chrome web debugger, you can simply connect to http://localhost:8004 (by default) and see the javascript console output in real time.

Typescript Support

OPTIONAL: There is a version with typescript support available, based on Types-for-Adobe. To work with this version, please checkout the branch rework. Install the typescript compiler tsc, use npm install again in the host folder and npm run-script run to start typescript compilation from the index.tsx to index.jsx. Although this version is more advanced, type support might be worth the extra effort.

More

If you want learn more about using AutoHotkey and the Adobe CEP SDK, have a look at this:

If there are more questions, you can contact me on Twitter or via mail.

You can’t perform that action at this time.