Rob Stemm
Forum Replies Created
-
Rob Stemm
November 18, 2008 at 10:39 pm in reply to: Script help to determine if AE was launched from the program icon vs. a project iconThanks for your help.
Rob
-
Rob Stemm
November 18, 2008 at 10:03 pm in reply to: Script help to determine if AE was launched from the program icon vs. a project iconI’ve tried that and they don’t seem to understand the need. The other thing I run into with that is they create their own copy of the template on their local system. When updates are made to the template on the server they continue to use their old copy rather than the new AEP I’ve created. At least with Scripts they cannot access them and I can update them on each box remotely knowing there is only one copy of the script to keep track of.
Rob
-
Rob Stemm
November 18, 2008 at 9:52 pm in reply to: Script help to determine if AE was launched from the program icon vs. a project iconI agree, but when you have 30 different artists wanting to do their own thing and you are trying to create a standard, forcing it on them with a script is easier than relying on them to duplicate a template every time. 🙂
Rob
Rob Stemm
-
Rob Stemm
November 18, 2008 at 9:31 pm in reply to: Script help to determine if AE was launched from the program icon vs. a project iconI have a default folder structure which should be built into every new after effects project. If the project is not a new one, the folder structure would already exist. The problem I was running into was that a new project is created even when you open an existing project, so this is what I was seeing when I opened an existing AEP file.
Application launches
New Project created
Folder structure added via startup script
New Project attemps to close
“Do you want to save” dialog appears because folders were added
Action: user clicks “no”
New Project closes
The AEP project that was originally selected from the desktop opensThe above is not ideal, so by delaying the script from adding the folder structure for 2 seconds we see the following behavior.
Application launches
New Project created
New Project closes
The AEP project that was originally selected from the desktop opens
Folder structure script runs and does not add foldersDoes this make sense?
Rob
Rob Stemm
-
Rob Stemm
November 18, 2008 at 8:59 pm in reply to: Script help to determine if AE was launched from the program icon vs. a project iconIn case any of you were wondering I had some help from the Adobe Forums.
Paul Tuersley wrote the following
“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 “
-
There is one area for improvement on this script and that is to not load the template file if a specific project or .aep file was double clicked to start the application. Currently if you are trying to open a project the application loads and opens the template instead of the project you double clicked. Is there a way to determine if the application was opened by clicking on the application icon or by double clicking an already existing project / .aep file.
Thanks,
RobRob Stemm
-
Rob Stemm
February 28, 2008 at 4:13 am in reply to: Scripting text causes mac and pc to run out of memoryThanks for your help. Looks like I finally have to go for the upgrade.
Rob
Rob Stemm
-
Rob Stemm
February 27, 2008 at 8:47 pm in reply to: Scripting text causes mac and pc to run out of memoryMike,
I’m running Photoshop CS2 Version 9.0.2. I’ve tried saving without going through Save for Web and this doesn’t seem to help. I’ve also tried changing the quotes and removing many of the declared variables outside of the for loop. Below is some optimized code for the above as well as moving the loop into a main function. I’ve removed all instances of “‘s in the array. Is this just a problem with CS2? I’ve even tried using a different font and setting the faux bold / small caps on the actual text layer instead of through script.
Any other ideas. Thanks for your suggestions.
Rob
///////////////////////////////////////////////////////////
var defaultRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;//POINTING TO THE PATH WHERE THE FILES SHOULD BE SAVED
var cPath = Folder.selectDialog(“Select a folder for the output files”);//ARRAY OF TEXT TO POPULATE TEXTITEM
var textArray = [
“Sample Text test 1”,
“here is some more text you would like”,
“This is an example of a quote”,
“Hope everything is going well”,
“Id like some dinner now”,
“Time is of the essance”,
“Do we need to go on?”,
“Me This is me in quotes”,
“Colorado is a great state”,
“Do you like to rock climb?”
]//ARRAY OF FILE NAMES
var fNameArray = [
“01”,
“02”,
“03”,
“04”,
“05”,
“06”,
“07”,
“08”,
“09”,
“10”
]var AD = app.activeDocument;
var TextLayer = AD.activeLayer;
var txtRef = TextLayer.textItem;
txtRef.fauxBold = true;
txtRef.capitalization = TextCase.SMALLCAPS;var newName = “”;
function myMainApp()
{//LOOP THAT DOES ALL OF THE WORK
for(var a=1;a<=textArray.length;a++) { try { txtRef.contents = textArray[a-1]; newName = fNameArray[a-1]; saveMyFile(cPath,AD,newName); } catch(e) { alert("Error Caught: " + e); } } alert("I'm Done :)"); } function saveMyFile(toWhere,file,name) { toWhere = new File(toWhere+"/"+name+".png"); saveOptions = new PNGSaveOptions(); file.saveAs(toWhere, saveOptions, true, Extension.LOWERCASE); } myMainApp(); app.preferences.rulerUnits = defaultRulerUnits; Rob Stemm -
That did the work. Thanks for your help!
Rob