copying files

    Apr 02 2007 | 6:10 pm
    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 { newFile.writebytes(myfile.readbytes(1)); } newFile.close(); myfile.close();
    There is probably a fundamental flaw in the while loop or the filetype, however I can not see my mistake.

    • Apr 02 2007 | 8:16 pm
      On 02-avr.-07, at 20:10, Maarten Zeinstra wrote:
      > while (myfile.eof
      Shouldn't it be the other way round?
      _____________________________ Patrick Delges
      Centre de Recherches et de Formation Musicales de Wallonie
    • Apr 03 2007 | 11:50 am
      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 03 2007 | 2:29 pm
      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.