copying files

Apr 2, 2007 at 6:10pm

copying files


I also posted this in the jitter subforum as a follow up on a different question, however the people interested in this topic would probably be here, also for building the knowledge database.

I am trying to copy a file using javascript. however when I can not open the copied file. The player will give me an error, unable to open file.

What am I doing wrong here?

myfile = new File(filename, “read”);;
if (myfile.isopen)
newName = new String(myfile.filename);
newName = newName.substring(0, newName.length – 4) + “_x.avi”;
newFile = new File(location + newName, “readwrite”, myfile.filetype);;
while (myfile.eof < = myfile.position)

There is probably a fundamental flaw in the while loop or the filetype, however I can not see my mistake.



Apr 2, 2007 at 8:16pm

On 02-avr.-07, at 20:10, Maarten Zeinstra wrote:

> while (myfile.eof < = myfile.position)

Shouldn’t it be the other way round?


Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie

Apr 3, 2007 at 11:50am

Yes you are absolutely right, I found that one out also.

However when I run the script the file gets copied ok, however Max crashes afterwards. Is there more stuff wrong here?



Apr 3, 2007 at 2:29pm

Well I’ve let go of the javascript solution and went into bash programming :)

With a simple script you can copy the file to a different location and have more control over the copy. using launchbrowser I can execute it, I think haven’t tested that part yet..

So thanks for your help. If you would like to take a look at the bash file you can mail me. I will not post it here because of the file alteration I also do.



You must be logged in to reply to this topic.