getting the length of an array from a Text-File?
Hi,
I am looking for a way of outputing a random word or group of words from a textfile.
I have gotten so far using $.evalFile expression to output text from a .txt file:
My .txt could look like this:
text1 = "word1";
text2 = "word2";
text3 = "word3";
text4 = ["word4", "word5", "a group of words", "another word"];
For text1-3 I can make a textlayers which are also called text1, text2, text3 and give them the Expression:
$.evalFile("/Users/rene/Desktop/AE\ TEST/sourcetext.txt");
eval(thisLayer.name)
For text4 I wrote:
r = Math.floor(random(3));
$.evalFile("/Users/rene/Desktop/AE\ TEST/sourcetext.txt");
eval(thisLayer.name)[r]
That works so far. But how can I write the Expression in a way, that it automatically recognizes the length of the text-array (= knowing how many elements there are to choose from) and put this into the random()?
thank you!
