Page 1 of 1

file size detection on drive

Posted: September 7th, 2007, 6:21 am
by tlawrimore
Hello,
Animation sequences often have bad frames. Usually a good way to check a sequene is in an explorer, with the "size" column ordered. The bad frames are easy to spot because they have an unusually small file size compared to the others.

I have a nice script that checks for the existance of each frame in a selected source file, but what I can't figure out is how to access the size.

"javascript"
var fso = newActiveXObject("Scripting.FileSystemObject");
var file = fso.getFile(c:\\temp\\animation.0001.tga);
var size = file.size;
alert("File size is: " + size);


I know AE doesn't use the FSO, and I know this is an easy one, but then again, I thought changing the font style via a script would be easy.
:?

Thanks in advance.
-Todd

Posted: September 7th, 2007, 10:11 am
by Dan Ebberts
I think you just need to use the length attribute, like this:

Code: Select all

var myFile = fileGetDialog("Select file.","");
if (myFile == null){
  alert ("No file selected.");
}else{
  alert ("" + myFile.length);
}
Dan

Posted: September 7th, 2007, 10:56 am
by tlawrimore
Hey Dan,
Thanks. I was hoping that was going to be an easy one.

I've now found the "bridge_javascript_ref.pdf" and it gave me more info on the file/folder object too.

Thanks for the help.
-Todd
Softimage Animator
Shaw Science Partners, Atlanta
http://www.shawscience.com

Posted: September 10th, 2007, 7:30 pm
by byronnash
Glad to see you on the forum Todd, happy coding.