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?
including external text file in an expression
-
- Posts: 17
- Joined: November 22nd, 2007, 4:56 am
- Location: Tel Aviv
- Contact:
You can read a file and eval its content using evalFile, like this:
This should work in both CS4 and CS5.
Code: Select all
$.evalFile(path_to_your_file)
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
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
-
- Posts: 320
- Joined: June 26th, 2004, 10:01 am
- Location: Folsom, CA
- Contact:
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
$.evalFile("/c/Expressions/text.txt");
I tried it with a text.txt file containing this:
"test"
and it seems to work fine.
Dan
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
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
-
- Posts: 320
- Joined: June 26th, 2004, 10:01 am
- Location: Folsom, CA
- Contact:
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
"Text Line 1\rText Line 2\rText Line 3"
Dan
THIS IS EXACTLY WHAT I WANTED!!!!!!!!! THANK YOU SO MUCH DAN!!!!!!
Davide
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