Copy link to clipboard
Copied
Hello,
I'm looking for a way how to use a global variable as the argument of the "footage" function. Not sure if it's possible at all.
It should be simple, but it doesn't work for some reason:
var path = eval(thisComp.layer("GlobalFileName").text.sourceText)
footage(path).dataValue([1,1,0,15]) + (" Frames")
In this version, I'm getting the "Couldn't find footage named 'Text Property' " error... So, it looks like the "footage" function can't read the "path" variable. Or probably can't use the variables at all?
But in this case, for example , it works just fine and I'm getting the proper text on the screen:
var path = eval(thisComp.layer("GlobalFileName").text.sourceText)
path
Any ideas how to fix that? Need that for parsing a lot of json files... just want to implement some automation.
Thank you,
Paul
it works this way -
path = thisComp.layer("Global_Text").text.sourceText.value
myFootage = footage(path);
footage(myFootage.name).dataValue([1,1,0,15]) + (" Frames")
Copy link to clipboard
Copied
Not sure exactly what you're trying to do, but you should be able to use a variable for the agrument to footage(), as long as it resloves to the name of a footage file already loaded into the project panel. For example, this simple sourcetext expression works if "drums.wav" has been imported:
path = "drums.wav";
myFootage = footage(path);
myFootage.name
Copy link to clipboard
Copied
Thank you for the reply, but unfortunately your example not working as well in my case. Please take a look at the attachment.
I want to use the sane "path" variable for a few different layers and expretions, but in terms of the same sequence.
So, I'm trying get the name of the file from source text of the designated text layer (Global_Text layer at the example attached).
Copy link to clipboard
Copied
Your code does not contain any proper string processing, so I'm not sure what you are hoping to do here. eval() simply returns an infinitely long unprocessed string that is treated as code that can be evaluated, but of course if it contains actual strings or URIs you have to isolate them from the rest and possibly account for operating system specific oddities like name handling, path delimiters and so on. You need to put in more effort and harden your code to make this work like adding toString() or decodeURI().
Mylenium
Copy link to clipboard
Copied
it works this way -
path = thisComp.layer("Global_Text").text.sourceText.value
myFootage = footage(path);
footage(myFootage.name).dataValue([1,1,0,15]) + (" Frames")