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!
This short guide will show how to install and use the AHK2PremiereCEP-Framework.
-
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
expressweb server. Don't forget to runnpm installon the console inside theclientfolder. For more information, head over to https://nodejs.org/ -
Follow this documentation to install the extension. Basicaly, you have to:
- Use
regeditto allow the execution of unsigned Adobe Premiere extensions. - Copy the downloaded code inside of an extension folder, described here. E.g.
C:\Program Files (x86)\Common Files\Adobe\CEP\extensions\AHK2PremiereCEP. - (Re) start Premiere.
- Use
-
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 themanifest.xml- file, located inside theCSXS- folder. -
Double click the extension window. This should open the plugins
host- folder with a file namedindex.jsxin 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!
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¶m2=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¶m2=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.
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:
- Start developing your new function using the Adobe ExtendScript Toolkit. Just specify
Adobe Premiere CCas targed and you're ready to go with your own javascript CEP code. - 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. - 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. - 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.
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.
If you want learn more about using AutoHotkey and the Adobe CEP SDK, have a look at this:
- Adobe CEP Premiere Samples: https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/PPRO/Premiere.jsx
- Premiere On Script, a Premiere CEP youtube channel: https://www.youtube.com/channel/UCmq_t_-4GLFu_nYaEDDModw
- Taran Van Hemert, a macro specialist: https://www.youtube.com/user/TaranVH
- And my own twitch channel, were I develop with these techniques, sometimes: https://www.twitch.tv/skate702
If there are more questions, you can contact me on Twitter or via mail.