Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Stephen Kennedy on July 30, 2012 at 12:39 pm

    Hi,

    I want to be able to save/load XML data from a script but can’t figure out the file system side of things, here is the code I am trying to write (basic test for now):

    var myBooks = new XML ( XML IN HERE );

    var myPath = "~/Desktop/myXML.xml";

    myBooks.file = new File(myPath);

    myBooks.file = File.saveDialog("Save the XML file");

    But it’s not working. The save dialog open but cannot save anything.
    Anyone know how to do this?

    Thanks,
    S

    Dan Ebberts replied 13 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    July 30, 2012 at 3:09 pm

    Try it this way:

    var myBooks = new XML ( XML IN HERE );
    var myStr = myBooks.toXMLString();
    var myPath = “~/Desktop/myXML.xml”;
    var myFile = File.saveDialog(“Save the XML file”);
    myFile.open(“W”);
    myFile.write(myStr);
    myFile.close();

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy