Setup
- in
.vscodefolder in your project root, create a filelaunch.json
{
"version": "0.1.0",
"configurations": [
{
"name": "[Your Tool] Debugger",
"type": "chrome",
Setup
.vscode folder in your project root, create a file launch.json{
"version": "0.1.0",
"configurations": [
{
"name": "[Your Tool] Debugger",
"type": "chrome",
| (function () { | |
| // Set path below to your aeq.js path | |
| //@include "path/to/aequery.js" | |
| function createPanel() { | |
| var win = aeq.ui.createWindow("Listbox Test"); | |
| var pnl = win.addPanel("List"); | |
| pnl.set({ | |
| orientation: "row", |
| (function () { | |
| var allEnums = { | |
| AlphaMode: {}, | |
| AutoOrientType: {}, | |
| BlendingMode: {}, | |
| ChannelType: {}, | |
| CloseOptions: {}, | |
| FastPreviewType: {}, | |
| FeetFramesFilmType: {}, | |
| FieldSeparationType: {}, |
| // Figuring out some math to determine aov, filmSize and focalLength in an AE camera, as these values aren't script-accessible. | |
| // Assuming units are pixels, film size measuring horizontally | |
| var comp = app.project.activeItem; | |
| var camera = your camera layer; | |
| var compSize = comp.width; | |
| var cameraZoom = camera.zoom; | |
| var depthOfField = camera.depthOfField; | |
| var focusDistance = camera.focusDistance; |
| (function () { | |
| /** | |
| * Gets currently open comp from timeline, as opposed to | |
| * selected comp in project panel | |
| * | |
| * @returns {CompItem | null} Active comp, or null if none | |
| */ | |
| function getFocusedComp() { | |
| var activeItem = app.project.activeItem; |
| // This will get the clipboard contents directly as a string | |
| var clipboardContents = system.callSystem("cmd /c \"for /f \"eol=; tokens=* delims= \" %I in ('powershell Get-Clipboard') do @set CLIPBOARD_TEXT=%I && echo %I\""); |
| function getTemplatePath () { | |
| if (parseFloat(app.version) < 14.0) return; | |
| try { | |
| if (app.preferences.havePref("Template Project", "Location", PREFType.PREF_Type_MACHINE_INDEPENDENT)) { | |
| return app.preferences.getPrefAsString("Template Project", "Location", PREFType.PREF_Type_MACHINE_INDEPENDENT); | |
| } else { | |
| throw new Error("Template Project Location preference does not exist."); | |
| } | |
| } catch(e) { |
| // This doesn't check that the selection is valid, or that it's an audio file. | |
| // Based on: http://stackoverflow.com/questions/21634091/is-it-possible-to-get-bitrate-of-mp3 | |
| (function () { | |
| var item = app.project.selection[0]; | |
| var duration = item.duration; | |
| var fileSize = item.file.length; | |
| var kbit = fileSize/128; | |
| var kbps = Math.ceil(Math.round(kbit / duration) / 16) * 16; |
| // Copy string from ESTK to Windows clipboard: | |
| var myString = "Here is a string"; | |
| var cmdString = 'cmd.exe /c cmd.exe /c "echo ' + myString + ' | clip"'; | |
| system.callSystem(cmdString); |
| (function getSelectedLayerType() { | |
| /** | |
| * Gets the type of a given layer | |
| * | |
| * @param {Layer} layer Layer to check | |
| * @return {string} Layer type | |
| */ | |
| function getLayerType(layer) { | |
| switch (layer.matchName) { | |
| case "ADBE Vector Layer": |