Is it a way to run my automation from a jsx Script?

Hi
I created an automation “my_automation” with this toolkit. It works perfectly thanks to your hepl on this forum :slight_smile:
But now I want to call the button “my_automation” from a jsx script, where I already do some actions on AfterEffects. Does it exist a documentation or something to do that ? Or a command I had to know to call the extension from Command Line ?

Thank you for your time :slight_smile:

Lucie

Hi @LucieDevGirl ,
running an automation from a jsx standalone script file is not supported in the free version of automation toolkit, in the pro version you can export an automation as a keyboard shortcut file that is essentially a jsx script file that tells automation toolkit to run an automation (from a json saved in the same jsx file), The only downside is that the extension has to be open in the background of After Effects.

Another option is to run the your existing jsx code from the automation, you can do it in the free version by using the project action, run javascript code, and paste your code there.

let me know if you have more questions :smiley:

Thank you for your answer. If I understand I have to create a keyboard shortcut for my automation once I bought the pro version, then trigger this shortcut from my jsx code ?

@LucieDevGirl yes, but a keyboard shortcut file is just a regular jsx script file that you can assign a keyboard shortcut later using the after effects keyboard shortcuts window.

for example, this is a keyboard shortcut jsx code for a simple automation that i exported from the pro version-

function sendEvent(type) {
    new ExternalObject("lib:PlugPlugExternalObject");
    var event = new CSXSEvent();
    event.data = '{"version":"2.0.3","json":{"name":"test","scope":[{"className":"ForLoop","iterationsType":"layers in the active comp","customIterations":2,"elementName":"loop1","enabled":true,"collapse":false,"elementAName":null,"elementAType":null,"elementAProperty":"","scope":[],"mainColor":[0.11579711576747997,0.4172038519467669,0.9189456236363223,1],"reverseOrder":false,"doPrecomps":false,"comment":false}],"loopCounter":2,"alertCounter":1,"textBoxCounter":1,"variableCounter":1,"useIcon":false,"icon":"","useColor":false,"description":"","write_external_files":false,"run_external_code":false,"enableComments":false}}'
    event.type = type;
    event.dispatch();
}

sendEvent("automation-toolkit-run-automation");

in this jsx code we create an event called “automation-toolkit-run-automation”, the event also contain the json data of the automation in “event.data”, we will send this event and the pro version of the Automation Toolkit Extension will capture this event and run this json as an automation.

So in your case you can right click on the automation button and click “create shortcut file”, it will create a file with a jsx code similar to the example code above with a different json, then you can copy the code and paste it in your existing jsx script file, and it should run the automation.

*Keep in mind that you’ll need the Automation Toolkit pro version open in the background to be able to run this code