Advertisement
glitchdetector

[GML] Generate File List

Oct 8th, 2016
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///iterate files and write
  2.  
  3. var OUTPUT, FILETYPE, STARTTAG, ENDTAG, PREFIX, SUFFIX;
  4. OUTPUT = "output.txt";
  5. FILETYPE = "mid";
  6. STARTTAG = "[";
  7. ENDTAG = "]";
  8. PREFIX = '"';
  9. SUFFIX = '",';
  10.  
  11. var file;
  12. file = file_text_open_write(OUTPUT);
  13.  
  14. var name;
  15. name = file_find_first("*." + FILETYPE,0);
  16. file_text_write_string(file,STARTTAG);
  17. file_text_writeln(file);
  18.  
  19. var files;
  20. files = 0;
  21.  
  22. while name != "" {
  23.     file_text_write_string(file,PREFIX + name + SUFFIX);
  24.     file_text_writeln(file);
  25.    
  26.     draw_clear(c_white);
  27.     draw_text(0,0,"Found: " + name);
  28.     screen_refresh();
  29.    
  30.     name = file_find_next();
  31.     files += 1;
  32. }
  33.  
  34. file_text_write_string(file,ENDTAG);
  35. file_text_writeln(file);
  36. file_text_close(file);
  37.  
  38. draw_clear(c_white);
  39. draw_text(0,0,"Done, found " + string(files) + " files. Output is in " + OUTPUT);
  40. screen_refresh();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement