home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / text / edit / macro / tex-scripts / gotosdvi.ged < prev    next >
Text File  |  1994-03-24  |  2KB  |  88 lines

  1. /*RX 
  2.    GoToSDVI.ged         NAME:GoToSDVI.ged       Version:1.00
  3.  
  4. - Load SDVI if it isn't running, with the current dvi file of the CED
  5.   view (if it's a tex file)
  6.  
  7. - Check if the current CED view filename (with dvi) is the filename in
  8.   ShowDVI. If it isn't, load it into SDVI. Check if DVI file is there.
  9.  
  10. - If the above things don't apply, bring SDVI to front.
  11.  
  12.   Ren\'e Laederach                      February 94
  13.  
  14. Done by:
  15.  
  16. R.Laederach
  17. Kappelisackerstr. 46
  18. 3063 Ittigen
  19. Switzerland
  20. Phone:+41/(0)31/912 19 08
  21.  
  22. This stuff ist PostcardWare, so send me a postcard or something useful (read
  23. the doc!).
  24. */
  25.  
  26. /* $VER: 0.9, ©1993 Dietmar Eilert. Empty GoldED macro */
  27.  
  28. OPTIONS RESULTS                             /* enable return codes     */
  29.  
  30. if (LEFT(ADDRESS(), 6) ~= "GOLDED") then    /* not started by GoldEd ? */
  31.     address 'GOLDED.1'
  32.  
  33. 'LOCK CURRENT'                              /* lock GUI, gain access   */
  34. OPTIONS FAILAT 6                            /* ignore warnings         */
  35. SIGNAL ON SYNTAX                            /* ensure clean exit       */
  36.  
  37. QUERY FILE
  38. filename=RESULT   /* No time to test new routine. Works OK */
  39. QUERY PATH
  40. pathname=RESULT
  41.  
  42.  
  43. if (RIGHT(pathname,1)) ~= ":" THEN DO
  44.     pathname = pathname||"/"
  45.     END
  46.  
  47. filename = left(filename,lastpos('.',filename)-1)
  48.  
  49. IF ~EXISTS(pathname||filename||".dvi") THEN DO
  50.     'REQUEST BODY="The corresponding .dvi file does not exist|Use Start_TeX to generate one."'
  51.     UNLOCK
  52.     EXIT
  53.     END
  54.  
  55.  
  56.  
  57. /* Now check if ShowDVI is running */
  58.  
  59. IF ~SHOW('P','showdvi') THEN DO
  60.         ADDRESS COMMAND "run <nil: >nil: tex:bin/ShowDVI" pathname||filename||".dvi"
  61.         UNLOCK
  62.         EXIT
  63.         END
  64.  
  65. UNLOCK /* I leave this as my scripts runs fine */
  66.  
  67. address "showdvi"
  68.  
  69. getfile
  70. loadedfile = RESULT
  71. getdir
  72. loadeddir = RESULT
  73.  
  74. IF RIGHT(loadeddir,1)~=':' & RIGHT(loadeddir,1)~='/' THEN
  75.         loadeddir = loadeddir||'/'
  76. IF loadeddir||loadedfile~=fullsrc THEN DO
  77.         loadnew fullsrc||".dvi"
  78.         tofront
  79.         activate
  80.         END
  81.    ELSE DO
  82.         tofront
  83.         activate
  84.         EXIT
  85.         END
  86.  
  87.  
  88.