home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 28 / amigaformatcd28.iso / -in_the_mag- / graphics / metaview / arexx-examples / sviewng_import.rexx < prev    next >
OS/2 REXX Batch file  |  1998-05-13  |  2KB  |  91 lines

  1. /* Graphik Import in DrawStudio mittels MetaView */
  2. /* 1997 by Andreas R. Kleinert                   */
  3.  
  4. METAVIEW = 'hd5:MetaView/MetaView'    /* Please complete the path */
  5.  
  6. OPTIONS RESULTS
  7. SIGNAL ON FAILURE
  8. SIGNAL ON SYNTAX
  9.  
  10. /*
  11. ** Looking for our start process
  12. */
  13.  
  14.  
  15. SVPORT = 'SViewNG.rx'
  16.  
  17. IF ~SHOW('P',SVPORT) THEN DO
  18.     say "Please start SViewNG before!"
  19.     EXIT
  20. end
  21.  
  22. /*
  23. ** Create a new Metaview process:
  24. ** first look for the allready running processes
  25. ** then the new Port will be the next one
  26. */
  27.  
  28. do NUMBER = 0 to 20
  29.     if (SHOW(PORTS,"METAVIEW." || NUMBER) = 0) then
  30.     leave
  31. end
  32.  
  33. /*
  34. ** Searching for MetaView: 1. our path above,
  35. **    2. path in env:MetaView.path
  36. ** or 3. you must have a assign "MetaView:"
  37. */
  38.  
  39. if (EXISTS(METAVIEW)=0) then do
  40.     if OPEN("MVVAR","env:MetaView.path","Read") then do
  41.         METAVIEW = READLN("MVVAR")
  42.     end
  43.     if (EXISTS(METAVIEW)=0) then do
  44.         METAVIEW = "MetaView:MetaView"
  45.     end
  46. end
  47.  
  48. /*
  49. ** Enable warnings for WaitForPort
  50. */
  51.  
  52. OPTIONS FAILAT 5
  53. ADDRESS COMMAND
  54.     "run " || METAVIEW || " NODISPLAY"
  55.     MVPORT = "METAVIEW." || NUMBER
  56.     "WaitForPort " || MVPORT
  57.  
  58. /*
  59. ** Ignore the other errors
  60. */
  61.  
  62. OPTIONS FAILAT 21
  63.  
  64. /*
  65. ** Do all needed thinks with MetaView (LOAD,SAVE,QUIT...)
  66. */
  67.  
  68. ADDRESS VALUE MVPORT
  69.     REQUESTFILE "Bilder:"
  70.     FILENAME = result
  71.     LOAD FILENAME
  72.     SAVE "t:mv_sv_import.ilbm" AS ILBM
  73.     QUIT
  74.  
  75. /*
  76. **  Import the temporary file in application
  77. */
  78.  
  79. ADDRESS VALUE SVPORT
  80.     'LOAD=t:mv_sv_import.ilbm'
  81.     EXIT
  82.  
  83. FAILURE:
  84.     ADDRESS COMMAND
  85.     REQUESTCHOICE "Error" """Can't find" METAVIEW "!""" "OK"
  86.     EXIT
  87.  
  88. SYNTAX:
  89.     say "Error on line" SIGL ":" ERRORTEXT(RC) "!"
  90.     EXIT
  91.