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

  1. /* Graphik Import 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. PVPORT = ADDRESS()
  14. say PVPORT
  15. if (LEFT(PVPORT, 9) ~= "ProVector") then do /* not started from ProVector */
  16.     say "Please start me from ProVector!"
  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. OPTIONS FAILAT 5
  51. ADDRESS COMMAND
  52.     "run " || METAVIEW || " NODISPLAY"
  53.     MVPORT = "METAVIEW." || NUMBER
  54.     "WaitForPort " || MVPORT
  55.  
  56. /*
  57. ** Ignore the other errors
  58. */
  59.  
  60. OPTIONS FAILAT 21
  61.  
  62. /*
  63. ** Do all needed thinks with MetaView (LOAD,SAVE,QUIT...)
  64. */
  65.  
  66. ADDRESS VALUE MVPORT
  67.     REQUESTFILE "Bilder:"
  68.     FILENAME = result
  69.     LOAD FILENAME
  70.     SAVE "t:test.dr2d" AS DR2D
  71.     QUIT
  72.  
  73. /*
  74. **  Import the temporary file in application
  75. */
  76.  
  77. ADDRESS VALUE PVPORT
  78.     OPEN "t:test.dr2d"
  79.  
  80. EXIT
  81.  
  82. FAILURE:
  83.     ADDRESS COMMAND
  84.     REQUESTCHOICE "Error" """Can't find" METAVIEW "!""" "OK"
  85.     EXIT
  86.  
  87. SYNTAX:
  88.     say "Error on line" SIGL ":" ERRORTEXT(RC) "!"
  89.     EXIT
  90.