-
Replacing a string of text from a text file (with a small twist)
Hi there,
I have an expression on my text layer which evaluates a variable in a text file to get a string:
$.evalFile(“/D:/main.txt”);
eval(thisLayer.name)And inside the main.txt:
string1 = “Hello world”And finally the text layer name is appropriately called “string1” so that the string is evaulated correctly and the text on screen is “Hello world”.
What I really want to do is to have more than one strings in my text file, like this:
string1 = “Hello world”
string2 = “Hello Mars”
string3 = “Hello Pluto”
text1 = “Human”
text2 = “Martian”
text3 = “Plutonian”And I want to define multiple strings by having two text layers called “string” and “text” and having a null object above simply called 1, 2 or 3 to change the text.
And have the expression as:$.evalFile(“/D:/main.txt”);
eval(thisLayer.name+(index-1))But it doesn’t work. Hope this vaguely makes sense. I’ve managed to achieve the effect adding the layer name to a slider value, but I’d rather do it with another layer. Thanks.