// -*- ASCII:EDT -*-
// TeX: dvi2ps ...

  Requires(20110812); // Requires this build of WinEdt to work properly

  PushTagsandRegisters;
  Assign('ExitCode-OK','0'); // OK Exit Code
  LetReg(9,'dvi2ps');   // Execution Modes Compiler
  LetReg(8,'');         // Log File (or empty)
  LetReg(7,'ps');       // Output Format
  LetReg(6,'%P');       // Startup Folder

  // Display a Dialog for Extra Switches:
  IfStr("%$('%!9-GUI');","1","=",>
    !|EnterSwitches('%!9',0,1,1,1,'-p','-l');>
      IfOK(!`Relax;`,!`PopTagsandRegisters;Exit;`);|,>
    !|Release('%!9--Switches');Release('%!9--Pages');|);
  LetReg(3, "%$('%!9-Executable'); %$('%!9-Switches');");
  LetReg(4,'');
  IfStr("%$('%!9-Paper_Size');","1","=",!|LetReg(4, "%!4 -t letter");|);
  IfStr("%$('%!9-Paper_Size');","2","=",!|LetReg(4, "%!4 -t legal");|);
  IfStr("%$('%!9-Paper_Size');","3","=",!|LetReg(4, "%!4 -t A4");|);
  IfStr("%$('%!9-Paper_Size');","4","=",!|LetReg(4, "%!4 -t %$('%!9-Paper_Custom_Size');");|);
  IfStr("%$('%!9-Landscape');", "1","=",!|LetReg(4, "%!4 -t landscape");|);
  // Build the Command Line ...
  LetReg(5, "%!3%!4 %$('%!9--Switches'); %$('%!9--Pages'); %$('%!9-Parameters');");

  // Use Execution Modes to determine the flow of execution...
  Exe('%b\Exec\ExeCompiler.edt');
  IfFileExists("%P\%N.ps",>
    !|IfStr("%$('%!9-Clean_Build');",!"1",!"=",>
       !||IfFileExists("%P\%N.dvi",!"DeleteFile('%P\%N.dvi')");||);|);
  UpdateStatus;   // Update WinEdt's Menu etc...
  PopTagsandRegisters;

End;
