Activity › Forums › Adobe After Effects Expressions › Recoginize file type with expressions?
-
Recoginize file type with expressions?
Posted by Mats Jacobsson on June 29, 2009 at 2:46 pmHi!
Is there an expression to recognize if the source file to a layer is vectorized or pixelated? It would also work if the expression just could detect the filetype of the layer.
Thanks in advance!
Dan Ebberts replied 16 years, 10 months ago 3 Members · 4 Replies -
4 Replies
-
Dan Ebberts
June 29, 2009 at 2:57 pmOnly if you can deduce it from the name of the source file (probably by looking at the file extension). Here’s an example that should detect PSD files (not tested, so watch out for typos):
mySplit = thisLayer.source.name.split[“.”]; // split source name at “.” characters
myExtension = mySplit[mySplit.length – 1]; // get everything to the right of the last “.”
if (myExtension.toLowerCase() == “psd”){
// it’s a psd file
}else{
// it’s not a psd file
}Dan
-
Jean Pier biasiolo merchan
June 29, 2009 at 6:17 pmDan you're the best because even though the topic was not for me has served me very
Un saludoThanks you're the best, but it was not the issue for me has a lot of greetings
-
Mats Jacobsson
June 30, 2009 at 7:02 amWow, thanks a lot! Just what I needed.
There was one small typo however, it should be (“.”) instead of [“.”] to work:
mySplit = thisLayer.source.name.split(“.”); // split source name at “.” characters
myExtension = mySplit[mySplit.length – 1]; // get everything to the right of the last “.”
if (myExtension.toLowerCase() == “psd”){
// it’s a psd file
}else{
// it’s not a psd file
} -
Dan Ebberts
June 30, 2009 at 1:31 pmGood catch. I’m glad you figured it out and that it works for you.
Dan
Reply to this Discussion! Login or Sign Up