AE ENHANCERS

Expressions/Scripts/Presets
It is currently Sat May 18, 2013 7:56 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: including external text file in an expression
PostPosted: Mon May 17, 2010 9:01 am 
Offline

Joined: Thu Nov 22, 2007 4:56 am
Posts: 17
Location: Tel Aviv
My expression is as follows:

#include 'file:///f:/collager/texts.txt';
try{eval(thisLayer.name)}catch(err){"not found"}


and I am applying it to the Source Text property of a text layer.
However, for some reason I am getten a Syntax Error on this.

What am I doing wrong?


Top
 Profile  
 
 Post subject: Re: including external text file in an expression
PostPosted: Mon May 17, 2010 2:59 pm 
Offline

Joined: Tue Nov 29, 2005 3:00 am
Posts: 201
Location: Paris
You can read a file and eval its content using evalFile, like this:
Code:
$.evalFile(path_to_your_file)

This should work in both CS4 and CS5.


Top
 Profile  
 
 Post subject: Re: including external text file in an expression
PostPosted: Tue Oct 18, 2011 10:29 pm 
Offline

Joined: Tue Oct 18, 2011 8:47 am
Posts: 3
Hi there, I'm new here.
I hope there will be someone that will help me.
I need to copy a text from an external .txt file and assign it to source text. I've tried everything was possible I've find here and also the following expressions I've found over the web but no chance to work in CS5.5. Please do everybody have a solution?

1)

myPath = “file://c:\\\\Expressions\\”;
myPath += “data.txt”;
$.evalFile (myPath);
eval(thisComp.name);
}catch(err){“Not Found”}

2)

$.evalFile("c:\\\\Expressions\\text.txt"); eval(thisLayer.name);

3)

myPath = "/media/text.txt";
try{
$.evalFile (myPath);
eval(thisComp.name);
}catch (err){
"not found"
}



Thank you so much in advance,

Davide


Top
 Profile  
 
 Post subject: Re: including external text file in an expression
PostPosted: Wed Oct 19, 2011 1:21 pm 
Offline

Joined: Sat Jun 26, 2004 10:01 am
Posts: 297
Location: Folsom, CA
Try it this way:

$.evalFile("/c/Expressions/text.txt");

I tried it with a text.txt file containing this:

"test"

and it seems to work fine.


Dan

_________________
http://www.motionscript.com


Top
 Profile  
 
 Post subject: Re: including external text file in an expression
PostPosted: Wed Oct 19, 2011 2:18 pm 
Offline

Joined: Tue Oct 18, 2011 8:47 am
Posts: 3
Hi Dan,
thank you so much for your help!!!
It worked!!!!! Just a question how can I do if I have a text on multiple raws?
THANK YOU AGAIN!!!!!!!!!

Davide

Dan Ebberts wrote:
Try it this way:

$.evalFile("/c/Expressions/text.txt");

I tried it with a text.txt file containing this:

"test"

and it seems to work fine.


Dan


Top
 Profile  
 
 Post subject: Re: including external text file in an expression
PostPosted: Wed Oct 19, 2011 2:36 pm 
Offline

Joined: Sat Jun 26, 2004 10:01 am
Posts: 297
Location: Folsom, CA
If I understand what you're asking, you just need to separate the text lines in your file with backslash+r, like this:

"Text Line 1\rText Line 2\rText Line 3"


Dan

_________________
http://www.motionscript.com


Top
 Profile  
 
 Post subject: Re: including external text file in an expression
PostPosted: Wed Oct 19, 2011 2:49 pm 
Offline

Joined: Tue Oct 18, 2011 8:47 am
Posts: 3
THIS IS EXACTLY WHAT I WANTED!!!!!!!!! THANK YOU SO MUCH DAN!!!!!!

Davide

Dan Ebberts wrote:
If I understand what you're asking, you just need to separate the text lines in your file with backslash+r, like this:

"Text Line 1\rText Line 2\rText Line 3"


Dan


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group