Expressions/Scripts/Presets

Moderator: byronnash

 
Cptzap
Topic Author
Posts: 5
Joined: Tue Jul 15, 2008 5:25 am
Location: Bergen, Norway

Font search

Thu Sep 11, 2008 10:27 pm

Hi! Is it possible to make a script that can find layers that use a certain font, and/or search in text being used to find words? Like the effects search script that can find layers that uses certain effects?
In my job I have to update text in old projects that has been made by others, and it's always a time-drain to navigate through projects that sometimes look like a bombed brothel :)

- Cptzap
 
Mylenium
Posts: 139
Joined: Wed Jul 20, 2005 12:07 am

Re: Font search

Fri Sep 19, 2008 9:45 am

You cannot query font properties as of yet. It should be possible to find strings with indexOf() or regex(). Not sure what exactly you are looking for.

Mylenium
[Pour Mylène, ange sur terre]
 
strawdog
Posts: 5
Joined: Mon Nov 10, 2008 9:35 am

Re: Font search

Mon Nov 10, 2008 10:55 am

I have somewhat glumly arrived at this conclusion also. I spent ages yesterday trying to find out which property I could get my script to query so that I could find out what font-family, weight and size a text layer was using without any success whatsoever.

Does anyone have any idea why this information is so hard to get or when it might likely become available? Seems at odds with how accessible everything else is.

I'm now considering either adding a custom property, or having some kind of prefix in the actual source text (the script I'm writing is for exporting animation information for our internal tech to use.)

Cheers
Simon
 
Mylenium
Posts: 139
Joined: Wed Jul 20, 2005 12:07 am

Re: Font search

Mon Nov 10, 2008 12:24 pm

strawdog wrote:
Does anyone have any idea why this information is so hard to get or when it might likely become available? Seems at odds with how accessible everything else is.


I guess you would have to spend considerable effort on it and start by separating the streams for this info in AE itself first. My knowledge is superficial at best, but handling fonts via scripts seems also complicated and limited in other Adobe apps, so it's surely a more generaic problem, probably due to the many options that need to be covered.

Mylenium
[Pour Mylène, ange sur terre]
 
Paul Tuersley
Posts: 704
Joined: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: Font search

Tue Nov 11, 2008 3:05 am

After Effects CS4 added more scripting support for text properties, but I don't think the documentation is available yet. Here's an example of how you'd query and change the font and font size:
{
   // select a text layer before running this script
   var activeItem = app.project.activeItem;
   var theValue = activeItem.selectedLayers[0].sourceText.value;
   
   alert("font = " + activeItem.selectedLayers[0].sourceText.value.font);
   alert("fontSize = " + activeItem.selectedLayers[0].sourceText.value.fontSize);
   
   theValue.font = "ArialMT";
   theValue.fontSize = 24;
   activeItem.selectedLayers[0].sourceText.setValue(theValue);
   
   alert("font = " + activeItem.selectedLayers[0].sourceText.value.font);
   alert("fontSize = " + activeItem.selectedLayers[0].sourceText.value.fontSize);
}
 
ScottHD
Posts: 11
Joined: Sat Jun 14, 2008 9:22 pm
Location: South Carolina

Re: Font search

Fri Nov 14, 2008 10:01 am

I can't wait until my AE CS4 upgrade gets here so I can try that new font scripting stuff out! That would be really handy at my job.
 
strawdog
Posts: 5
Joined: Mon Nov 10, 2008 9:35 am

Re: Font search

Thu Nov 20, 2008 9:49 am

Yes, this should be useful.
I don't suppose anyone knows if the text bounding box is available to scripts in CS4?
 
Paul Tuersley
Posts: 704
Joined: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: Font search

Thu Nov 20, 2008 1:04 pm

There's nothing new related to that in CS4. Do you know about sourceRectAtTime() that was added in CS3? Also, maybe you've already seen that there are quite a few posts about this on here.

Paul
 
strawdog
Posts: 5
Joined: Mon Nov 10, 2008 9:35 am

Re: Font search

Thu Nov 20, 2008 2:39 pm

No I hadn't spotted that, thanks.
I guess my thread search queries weren't on the right wavelength! :)
 
jayse
Posts: 12
Joined: Mon Nov 22, 2004 5:45 pm
Location: vegas
Contact:

Re: Font search

Sat Feb 21, 2009 10:01 am

Lloyd gave a preview of just such a script "pt_TextEdit" at his aeny presentation a few days ago http://vimeo.com/3031889?pg=embed&sec=3031889&hd=1

only question is... Paul - WHEN??? when can we have it!? Looks excellent!

:-)
 
Paul Tuersley
Posts: 704
Joined: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: Font search

Mon Feb 23, 2009 1:01 pm

pt_TextEdit is undergoing a bit of a rewrite at the moment, but it should be ready within the next few weeks.

Paul
 
c_wall
Posts: 5
Joined: Sat Mar 21, 2009 2:01 am

Re: Font search

Thu Apr 30, 2009 6:54 pm

I am waiting by the phone so to speak for you to call and tell my my prince (pt_edit) is here!
 
Paul Tuersley
Posts: 704
Joined: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: Font search

Thu May 07, 2009 3:50 am

I'm releasing betas of pt_TextEdit and pt_ExpressEdit right now. See here for details:
viewtopic.php?f=9&t=1380
viewtopic.php?f=9&t=1381
 
Paul Tuersley
Posts: 704
Joined: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: Font search

Tue Feb 02, 2010 3:32 pm

It took a little longer to finish than I'd anticipated but pt_TextEdit is finally released:
Watch demo and download pt_TextEdit from aescripts.com
 
sbaden
Posts: 35
Joined: Tue Jun 16, 2009 1:07 pm
Location: Santa Clarita, CA
Contact:

Re: Font search

Wed Oct 13, 2010 9:57 am

Paul Tuersley wrote:
After Effects CS4 added more scripting support for text properties, but I don't think the documentation is available yet. Here's an example of how you'd query and change the font and font size:
{
   // select a text layer before running this script
   var activeItem = app.project.activeItem;
   var theValue = activeItem.selectedLayers[0].sourceText.value;
   
   alert("font = " + activeItem.selectedLayers[0].sourceText.value.font);
   alert("fontsize = " + activeItem.selectedLayers[0].sourceText.value.fontSize);
   
   theValue.font = "ArialMT";
   theValue.fontSize = 24;
   activeItem.selectedLayers[0].sourceText.setValue(theValue);
   
   alert("font = " + activeItem.selectedLayers[0].sourceText.value.font);
   alert("fontSize = " + activeItem.selectedLayers[0].sourceText.value.fontSize);
}

I'm wondering if I can use the script above that Paul wrote to manipulate multiple styles within the same text field...

For example: First name in HelveticaBld and last name in HelveticaLt on the same line. They would be in the same line so I couldn't set theValue as the selectedLayer because there would be two values for the same line... Am I making sense? :)

Would something like this work? I'm using CS5.
var name = comp.layer(i).sourceText;
   
   firstNameValue.font = "Helvetica Neue LT Std";
   firstNameValue.fontstyle = "73 Bold Extended";
   firstNameValue.fontsize = 24;
   
   lastNameValue.font = "Helvetica Neue LT Std";
   lastNameValue.fontstyle = "55 Roman";
   lastNameValue.fontSize = 24;
   
   name.setValue(firstNameValue.toUpperCase() + " " + lastNameValue);


I realized that this still doesn't account for the actual text itself... firstName = shawn, lastName = baden...

Who is online

Users browsing this forum: No registered users and 3 guests