home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 28 / amigaformatcd28.iso / -in_the_mag- / graphics / metaview / arexx-examples / drawstudio_export.dsrx < prev    next >
Text File  |  1998-05-13  |  2KB  |  122 lines

  1. /* Graphik Export mittels MetaView */
  2.  
  3. METAVIEW = ':Aminet/MetaView/MetaView'    /* Please complete the path */
  4.  
  5. OPTIONS RESULTS
  6. SIGNAL ON FAILURE
  7. SIGNAL ON SYNTAX
  8.  
  9. /*
  10. ** Looking for our start process
  11. */
  12.  
  13. APLPORT = ADDRESS()
  14. say APLPORT
  15. if (LEFT(APLPORT, 10) ~= "DRAWSTUDIO") then do /* not started from Application */
  16.     say "Please start me from DrawStudio!"
  17.     EXIT
  18. end
  19.  
  20. /*
  21. ** Create a new Metaview process:
  22. ** first look for the allready running processes
  23. ** then the new Port will be the next one
  24. */
  25.  
  26. do NUMBER = 0 to 20
  27.     if (SHOW(PORTS,"METAVIEW." || NUMBER) = 0) then
  28.     leave
  29. end
  30.  
  31. /*
  32. ** Searching for MetaView: 1. our path above,
  33. **    2. path in env:MetaView.path
  34. ** or 3. you must have a assign "MetaView:"
  35. */
  36.  
  37. if (EXISTS(METAVIEW)=0) then do
  38.     if OPEN("MVVAR","env:MetaView.path","Read") then do
  39.         METAVIEW = READLN("MVVAR")
  40.     end
  41.     if (EXISTS(METAVIEW)=0) then do
  42.         METAVIEW = "MetaView:MetaView"
  43.     end
  44. end
  45.  
  46. /*
  47. ** Enable warnings for WaitForPort
  48. */
  49.  
  50. say NUMBER
  51. OPTIONS FAILAT 5
  52. ADDRESS COMMAND
  53.     "run " || METAVIEW || " NODISPLAY"
  54.     MVPORT = "METAVIEW." || NUMBER
  55.     "WaitForPort " || MVPORT
  56.  
  57. /*
  58. ** Ignore the other errors
  59. */
  60.  
  61. OPTIONS FAILAT 21
  62.  
  63. /*
  64. **  Export the temporary file in application
  65. */
  66.  
  67. ADDRESS VALUE APLPORT
  68.     PROJECT_SAVE "t:test.dsdr" FORCE
  69.  
  70. /*
  71. ** Do all needed thinks with MetaView (LOAD,SAVE,QUIT...)
  72. */
  73.  
  74. ADDRESS VALUE MVPORT
  75.     LOAD "t:test.dsdr"
  76.  
  77.     REQUESTCHOICE TITLE "Request" BODY """Choose the format to save""" BUTTONS "AMF|WMF|DR2D|CGM|GEM|EPS|AI|HPGL|ILBM"
  78.  
  79.     CHOICE = rc
  80.     REQUESTFILE "RAM:" TITLE """Please chooce filename"""
  81.     FILENAME = result
  82.     say CHOICE FILENAME
  83.     if (CHOICE = 1) then do
  84.       SAVE FILENAME AS AMF
  85.     end
  86.     if (CHOICE = 2) then do
  87.       SAVE FILENAME AS WMF
  88.     end
  89.     if (CHOICE = 3) then do
  90.       SAVE FILENAME AS DR2D
  91.     end
  92.     if (CHOICE = 4) then do
  93.       SAVE FILENAME AS CGM
  94.     end
  95.     if (CHOICE = 5) then do
  96.       SAVE FILENAME AS GEM
  97.     end
  98.     if (CHOICE = 6) then do
  99.       SAVE FILENAME AS EPS
  100.     end
  101.     if (CHOICE = 7) then do
  102.       SAVE FILENAME AS AI
  103.     end
  104.     if (CHOICE = 8) then do
  105.       SAVE FILENAME AS HPGL
  106.     end
  107.     if (CHOICE = 0) then do
  108.       SAVE FILENAME AS ILBM
  109.     end
  110.     QUIT
  111.  
  112. EXIT
  113.  
  114. FAILURE:
  115.     ADDRESS COMMAND
  116.     REQUESTCHOICE "Error" """Can't find" METAVIEW "!""" "OK"
  117.     EXIT
  118.  
  119. SYNTAX:
  120.     say "Error on line" SIGL ":" ERRORTEXT(RC) "!"
  121.     EXIT
  122.