home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / WordProcessors / PAGESTREAM3,0-1.DMS / in.adf / Macros.LHA / SendtoBME.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1994-08-30  |  3.3 KB  |  110 lines

  1. /* SendToBME.rexx */
  2. /* Copyright 1994 Soft-Logik Publishing Corporation */
  3. /* May not be distributed without Soft-Logik Publishing Corporation's express written permission */
  4. /* $VER: 1.0 */
  5.  
  6. OPTIONS RESULTS
  7. TRACE OFF
  8.  
  9. /* Make sure rexx support is opened */
  10. IF ~SHOW('L','rexxsupport.library') THEN
  11.    CALL ADDLIB('rexxsupport.library',0,-30)
  12.  
  13. ADDRESS 'PAGESTREAM'
  14.  
  15. /* Check and see if one picture is selected */
  16. getobject type objtype
  17. if objtype~=12 then do
  18.     ADDRESS 'PAGESTREAM'
  19.     allocarexxrequester '"Send to Editor Error!"' 368 59
  20.     reqhandle=result
  21.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  22.         Exithandle=result
  23.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'One picture must be selected to edit in BME.'"
  24.     addarexxgadget reqhandle TEXT 8 20 352 border none string "'Select only one picture and try again.'"
  25.     doarexxrequester reqhandle
  26.     freearexxrequester reqhandle
  27.     EXIT
  28. end
  29.  
  30. /* Export the picture to a temp file */
  31. 'lockinterface true'
  32. 'exportgraphic file t:HotLinkedPicture filter iffilbm status force'
  33. /* Eventually will just make picture external, but not this version */
  34. /* 'editpicture external file t:HotLinkedPicture' */
  35. 'refresh wait'
  36.  
  37. /* set the default BME path */
  38. bmepath='PageStream3:BME'
  39.  
  40. /* If BME doesn't exist in the default path, ask the user where it is */
  41. if ~exists('PageStream3:BME') then do
  42.     getfile TITLE "'Please locate BME'" load path "'PageStream3:'" file BME posbutton 'Ok' negbutton 'Cancel'
  43.     if RC=10 then signal cancel
  44.     bmepath=result
  45. end
  46.  
  47. /* Run BME */
  48. ADDRESS COMMAND
  49. 'run >nil:' bmepath
  50.  
  51. /* Wait until the ARexx port shows up */
  52. do 20
  53.     if ~show(P, 'BME') then call delay(50)
  54. end
  55.  
  56. /* If the ARexx port didn't show up, alert the user and exit */
  57. if ~show(P, 'BME') then do
  58.     ADDRESS 'PAGESTREAM'
  59.     geterrorstring
  60.     ErrorMsg='Error: '||result
  61.     allocarexxrequester '"Send to Editor Error!"' 368 59
  62.     reqhandle=result
  63.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  64.         Exithandle=result
  65.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'BME could not be started.'"
  66.     addarexxgadget reqhandle TEXT 8 20 352 border none string ErrorMsg
  67.     doarexxrequester reqhandle
  68.     freearexxrequester reqhandle
  69.     'refresh continue'
  70.     'lockinterface false'
  71.     EXIT
  72. end
  73.  
  74. ADDRESS 'BME'
  75. 'screentofront'
  76. 'open t:HotLinkedPicture'
  77.  
  78. /* While the user is in BME, let's get some info about the pic from PageStream */
  79. ADDRESS 'PAGESTREAM'
  80. getpicture position pstem frame fflag contentoffset cstem contentscale cstem rotation rstem about rstem constrain cflag print pflag
  81.  
  82. /* Wait for the user to finish in BME */
  83. do forever
  84.     if show(P, 'BME') then call delay(50)
  85.         else signal update
  86. end
  87.  
  88. /* update pgs and exit */
  89. UPDATE:
  90. ADDRESS 'PAGESTREAM'
  91. 'screentofront'
  92. /* Eventually will just make picture external, but not this version */
  93. /* 'editpicture path t:HotLinkedPicture' */
  94. /* 'editpicture internal' */
  95.  
  96. 'deleteobject'
  97. 'placegraphic file t:HotLinkedPicture filter iffilbm'
  98. editpicture position pstem.left pstem.top pstem.right pstem.bottom skew rstem.slant rstem.twist
  99. if fflag=ON then editpicture framed contentoffset cstem.x cstem.y contentscale cstem.h cstem.v
  100. editpicture
  101. signal cancel
  102.  
  103. CANCEL:
  104. ADDRESS 'PAGESTREAM'
  105. 'refresh continue'
  106. 'lockinterface false'
  107. ADDRESS COMMAND
  108. 'delete t:HotLinkedPicture'
  109. EXIT
  110.