Skip to content

takeshi-okuya/AEPython

Repository files navigation

AE Python

Python scripting plugin for After Effects

Read this document in other languages: Japanese

Features

System Requirements

  • Adobe After Effects CS6 / CC~
  • Windows 10 / 11
  • Python 3.10.9 (included in the distribution Zip)

Installation

Copy each files and folders in the distribution Zip to the following locations.

  • AEPython folder -> C:\Program Files\Adobe\Adobe After Effects {version}\Support Files\Plug-ins\AEPython
  • AEPython.jsx -> C:\Program Files\Adobe\Adobe After Effects {version}\Support Files\Scripts\Startup\AEPython.jsx

License

MIT License (see LICENSE.)

Scripting Guide

Run Python scripts from the Python Window

Select menu: Window -> Python

comp = ae.app.project.items.addComp("Comp1", 1920, 1080, 1, 10, 24)
comp.bgColor = [1.0, 1.0, 1.0]

text_layer = comp.layers.addText("This is an AE Python sample.")

text_prop = text_layer.property("Source Text")
text_document = text_prop.value
text_document.fontSize = 50
text_prop.setValue(text_document)

Run .py files from the Python Window

Select .py file from File -> "Execute Python File" in the AEPython window.

[sample.py]

import AEPython as ae
ae.alert(ae.app.project.file)

Run Python scripts from ExtendScript

Python.exec("ae.app.project.activeItem.name = 'New Name'");

Run .py files from ExtendScript

Python.execFile("D:/sample.py");

GUI by Qt

from PySide2 import QtWidgets

import AEPython as ae
import qtae

class MyDialog(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super().__init__(parent)

        layout = QtWidgets.QVBoxLayout()

        self.text_input = QtWidgets.QLineEdit("")
        layout.addWidget(self.text_input)

        self.button = QtWidgets.QPushButton("Add Text Layer!")
        self.button.clicked.connect(self.onButtonClicked)
        layout.addWidget(self.button)

        self.setLayout(layout)

    def onButtonClicked(self):
        text = self.text_input.text()
        layer = ae.app.project.activeItem.layers.addText(text)
        layer.position.setValue([100,100])

dialog = MyDialog(qtae.GetQtAEMainWindow())
dialog.show()