🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.after.effects.scripting.render
4 messages
4 total messages Started by Rob_Stemm Tue, 18 Nov 2008 18:17
Startup Script to run if application is launched vs project launched
#17
Author: Rob_Stemm
Date: Tue, 18 Nov 2008 18:17
5 lines
1015 bytes
Is there a way to determine whether the After Effects application was started by clicking on the Program icon or by double clicking an .aep file. Basically I'd like a script in my startup folder to run if the application was started by clicking on the application icon and to not run if an already existing project was double clicked to open After Effects.

Thanks for any advice.

Rob
Re: Startup Script to run if application is launched vs project launched
#18
Author: Jeff_Almasol
Date: Tue, 18 Nov 2008 20:20
9 lines
1001 bytes
Hi Rob,

Assuming your existing project actually has items in it, you might be able to check if app.project.numItems > 0 to proceed with the script or not.

Note that you can't just check if the app.project.file == null because a project saved in an earlier version of After Effects will come in as untitled.

Hope this helps.

Jeff
Re: Startup Script to run if application is launched vs project launched
#19
Author: Paul_Tuersley
Date: Tue, 18 Nov 2008 20:20
22 lines
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
Re: Startup Script to run if application is launched vs project launched
#20
Author: Rob_Stemm
Date: Tue, 18 Nov 2008 21:00
3 lines
782 bytes
Thanks for your help Paul. This worked well for my particular application.

Rob
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads