Article View: adobe.after.effects.scripting.render
Article #19Re: Startup Script to run if application is launched vs project launched
From: Paul_Tuersley
Date: Tue, 18 Nov 2008 20:20
Date: Tue, 18 Nov 2008 20:20
22 lines
1705 bytes
1705 bytes
At first I didn't think so. After Effects runs the startup script before opening the project, and the script doesn't have access to that information.
But I have managed to come up with this:
{
function check() {
//if (app.project.file == null) {
if (app.project.numItems == 0) {
writeLn("AE was opened with no project");
} else {
writeLn("AE was opened with a project");
}
}
app.scheduleTask("check()",1000,repeat=false)
}
I'm using app.scheduleTask to get the main part of the script to run one second later. This seems to be enough time for a project to start loading if there is one, and the script then runs after the project has loaded.
At first I was checking if the project had a file path (app.project.file == null) but this wasn't catching projects that opened as untitled.aep due to importing an older project version, so I changed it to check if the project was empty (app.project.numItems == 0).
Paul
Technical Details
Message-ID:
<59b70f1e.1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!85.214.105.209.MISMATCH!news.eternal-september.org!news.motzarella.org!motzarella.org!news4us.nl!webcrossingReferences:
<59b70f1e.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efebe,e0ad89b731db308e X-Google-Attributes: gid1efebe,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Paul_Tuersley@adobeforums.com Newsgroups: adobe.after.effects.scripting.render Subject: Re: Startup Script to run if application is launched vs project launched Message-ID: <59b70f1e.1@webcrossing.la2eafNXanI> Date: Tue, 18 Nov 2008 12:20:52 -0800 References: <59b70f1e.-1@webcrossing.la2eafNXanI> Lines: 30 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!85.214.105.209.MISMATCH!news.eternal-september.org!news.motzarella.org!motzarella.org!news4us.nl!webcrossing