SHARE
TWEET

TeXStudio Macro for LaTeXdiff

a guest Aug 30th, 2017 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. %SCRIPT
  2.  
  3. var cf = app.getCurrentFileName();
  4.  
  5. var ld = new String(cf);
  6. ld=ld.substring(0,ld.lastIndexOf("/"));
  7.  
  8. information("Select original file");
  9. fileChooser.setDir(ld);
  10. fileChooser.setFilter("TeX files (*.tex)");
  11. fileChooser.exec();
  12. var fold=new String();
  13. fold=fileChooser.fileName();
  14. fold=fold.substring(fold.lastIndexOf("/")+1);
  15.  
  16. information("Select revised file");
  17. fileChooser.setDir(ld);
  18. fileChooser.setFilter("TeX files (*.tex)");
  19. fileChooser.exec();
  20. var fnew=new String();
  21. fnew=fileChooser.fileName();
  22. fnew=fnew.substring(fnew.lastIndexOf("/")+1);
  23.  
  24. information("Select changes tracking file");
  25. fileChooser.setDir(ld);
  26. fileChooser.setFilter("TeX files (*.tex)");
  27. fileChooser.exec(fout);
  28. var fout=new String();
  29. fout=fileChooser.fileName();
  30. fout=fout.substring(fout.lastIndexOf("/")+1);
  31.  
  32. ldfout = ld+"\\"+fout;
  33.  
  34. var cmdstr = new String();
  35. cmdstr = "latexdiff-so "+fold+" "+fnew+" > /dev/null";
  36. var proc = system("cmd /C "+cmdstr,ld);
  37. proc.waitForFinished();
  38. writeFile(ldfout, proc.readAllStandardOutputStr());
  39. app.load(ldfout); // load diff file
  40. buildManager.runCommand("txs:///quick", ldfout);
  41.  
  42. delete(cmdstr);
  43. delete(dialog);
  44. delete(fold);
  45. delete(fnew);
  46. delete(fout);
  47. delete(ld);
  48. delete(ldfout);
RAW Paste Data
Top