FORUMS: list search recent posts

Read a file with After Effects Script?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
joshua faget
Read a file with After Effects Script?
on Nov 3, 2016 at 2:44:01 pm

Hello,

I want to open a file on the system and alert its contents, but for a reason which is unknown to me, the following script returns a blank alert box.

I know that opening a .jpeg will return a bunch of characters and weird stuff, but that is what I actually want. I want the "source code" of the file.

Maybe there is another workaround.... my goal is to get the binary data of the file.

Thank you.

var openFile = File.openDialog("r");
var content = openFile.read();

alert(content);


Return to posts index

Xavier Gomez
Re: Read a file with After Effects Script?
on Nov 3, 2016 at 3:48:16 pm

The dialog will create a file object, but does not actually opens it for reading. This is another step:

var file = File.openDialog();
if (file && file.open("r")){
var content = file.read();
file.close();
alert(content);
};

Xavier


Return to posts index

joshua faget
Re: Read a file with After Effects Script?
on Nov 3, 2016 at 4:54:24 pm

When I do the following, im getting a blank new file.

I'd like to be able to duplicate a .jpg file for example that way, so halfway through I can mess with the building blocks of the file.

var file = File.openDialog();
if (file && file.open("r")){
var content = file.read();
file.close();

//do stuff to var content here

var save = File.saveDialog();
var newFile = new File(save);
newFile.open("w");
newFile.write(content);
newFile.close;

};


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]