Arbitrary File I/O in Scripting?

edited December 1969 in Daz Studio Discussion

Hi - I'm wondering if anyone has insights on importing data from arbitrary formats in DAZ scripts? e.g., binary or text files with lists of coordinates. That sort of thing. I'd like to use the values coming from other programs to set parameters in my scripts. Surely there's a way to do this?

Thanks!

Comments

  • Richard HaseltineRichard Haseltine Posts: 102,218
    edited December 1969

    You can open and read a file, byte by byte or line by line, with DzFile. Something like

    var myFile = new DzFile( "C:\Example.txt" );
    
    if ( myFile.open( myFile.ReadOnly ) {
         while ( ! myFile.eof() ) {
              doStuff( myFile.readByte() );
         }
         myFile.close();
    }
  • edited December 1969

    Phenomenal. And perfect timing – I was just about to write an image-based encoding scheme, since I'd at least figured out how to load images and read the pixel values. This will be a bit less awkward...

    Thanks!

Sign In or Register to comment.