home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / WordProcessors / slt-pgs3.lzx / PageStream3 / Scripts / SendtoProVector.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-10-20  |  5.0 KB  |  169 lines

  1. /* $VER: SendtoProVector.rexx 1.0a (21.05.96)
  2.    Based on "SendtoBME.rexx" 
  3.    Modified for ProVector® by Jeff Blume - Stylus, Inc.
  4.    ML: changed all picture references to drawings
  5.  
  6.    "SendtoBME.rexx" Copyright 1996 Soft-Logik Publishing Corporation
  7.    May not be distributed without Soft-Logik Publishing Corporation's express written permission.
  8.    Permission is granted to include this script with ProVector.
  9. */
  10.  
  11. OPTIONS RESULTS
  12. TRACE OFF
  13.  
  14. /* Make sure rexx support is opened */
  15. IF ~SHOW('L','rexxsupport.library') THEN
  16.    CALL ADDLIB('rexxsupport.library',0,-30)
  17.  
  18. ADDRESS 'PAGESTREAM'
  19.  
  20. /* Check and see if one drawing is selected */
  21. getobject type objtype
  22. if objtype~=2 then do
  23.     ADDRESS 'PAGESTREAM'
  24.     allocarexxrequester '"Send to ProVector Error!"' 368 59
  25.     reqhandle=result
  26.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  27.         Exithandle=result
  28.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'One drawing must be selected to edit in ProVector.'"
  29.     addarexxgadget reqhandle TEXT 8 20 352 border none string "'Select only one drawing and try again.'"
  30.     doarexxrequester reqhandle
  31.     freearexxrequester reqhandle
  32.     EXIT
  33. end
  34.  
  35. /* Export the drawing to a temp file */
  36. 'lockinterface true'
  37. 'exportgraphic file t:HotLinkedDrawing filter iffdr2d status force'
  38. /* Eventually will just make drawing external, but not this version */
  39. /* 'editdrawing external file t:HotLinkedDrawing' */
  40. 'refresh wait'
  41.  
  42. /* set the default ProVector path */
  43. call pragma('W', 'Null')    /* So DOS requester suppressed, sans PV: assignment */
  44. PVpath='PV:ProVector'
  45. preffile='PageStream3:SendtoProVector.prefs'
  46.  
  47. /* If ProVector doesn't exist in the default path, check SendtoProVector.prefs */
  48. if ~exists(PVpath) then do
  49.     if open(.ifile, preffile, 'R') then do
  50.         PVpath=readln(.ifile)
  51.         call close(.ifile)
  52.         askuser='no'
  53.         end
  54.     else do
  55.         askuser='yes'
  56.     end
  57.     /* If ProVector doesn't exist in the set pref path, ask the user where it is */
  58.     if ~exists(PVpath) | askuser='yes' then do
  59.         getfile TITLE "'Please locate ProVector'" load path "'PageStream3:'" file ProVector posbutton 'Ok' negbutton 'Cancel'
  60.         if RC=10 then signal cancel
  61.         PVpath=result
  62.         if open(.ifile, preffile, 'W') then do
  63.             call writeln(.ifile, PVpath)
  64.             call close(.ifile)
  65.         end
  66.     end
  67. end
  68.  
  69. /* Run ProVector after setting path to ProVector path for PROGDIR: references */
  70. FNameIdx = LastPos("/",PVPath)    /* Index to simple filename */
  71. if FNameIdx = 0 then FNameIdx = lastpos(":",PVPath)
  72. PVDir = Left(PVPath,(FNameIdx -1))
  73. call Pragma('D',PVDir)
  74. call Pragma('S',8000)
  75. if ~show(P, 'ProVector') then ADDRESS COMMAND 'run >nil:' PVpath "AskRes=False"
  76.  
  77. /* Wait until the ARexx port shows up */
  78. do 20
  79.     if ~show(P, 'ProVector') then call delay(50)
  80. end
  81.  
  82. /* If the ARexx port didn't show up, alert the user and exit */
  83. if ~show(P, 'ProVector') then do
  84.     ADDRESS 'PAGESTREAM'
  85.     allocarexxrequester '"Send to Editor Error!"' 368 59
  86.     reqhandle=result
  87.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  88.         Exithandle=result
  89.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'ProVector could not be started.'"
  90.     doarexxrequester reqhandle
  91.     freearexxrequester reqhandle
  92.     'refresh continue'
  93.     'lockinterface false'
  94.     EXIT
  95. end
  96.  
  97. /* Obviously, this won't always go to the ProVector screen, but since 'screentofront'
  98.    has no equivalent in ProVector... (yes, there should be - JB) */
  99. 'ScreenToBack'
  100.  
  101. ADDRESS 'ProVector'
  102. 'Lock Wait'
  103. 'Open T:HotLinkedDrawing'
  104. 'GetBool "Save & close to update PageStream." "OK" "OK"'
  105. 'UnLock'
  106.  
  107. /* While the user is in ProVector, let's get some info about the pic from PageStream */
  108. ADDRESS 'PAGESTREAM'
  109. getdrawing position pstem frame fflag contentoffset cstem contentscale cstem rotation rstem about rstem constrain cflag print pflag
  110. gettextwrap region wmode wrap wtype standoff wstem
  111.  
  112. /* Wait for the user to finish in ProVector */
  113. ADDRESS 'ProVector'
  114. do forever
  115.     if ~show(P, 'ProVector') then signal update
  116.     if GetDrawing() then call Delay(50)
  117.     else signal UpDate
  118. end
  119.  
  120. /* update PGS and exit */
  121. UPDATE:
  122. ADDRESS 'PAGESTREAM'
  123. 'screentofront'
  124. /* Eventually will just make drawing external, but not this version */
  125. /* 'editdrawing path T:HotLinkedDrawing' */
  126. /* 'editdrawing internal' */
  127.  
  128. 'deleteobject'
  129. 'placegraphic file T:HotLinkedDrawing filter IFFDR2D'
  130. editdrawing position pstem.left pstem.top pstem.right pstem.bottom skew rstem.slant rstem.twist
  131. if fflag=ON then editdrawing framed contentoffset cstem.x cstem.y contentscale cstem.h cstem.v
  132. settextwrap wmode standoff wstem.x wstem.y wtype
  133. /* Next clause not really needed, since UpDate has no return statement */
  134. signal cancel
  135.  
  136. CANCEL:
  137. ADDRESS 'PAGESTREAM'
  138. 'refresh continue'
  139. 'lockinterface false'
  140. ADDRESS COMMAND
  141. 'delete T:HotLinkedDrawing'
  142. EXIT
  143.  
  144.  
  145. GETDRAWING:
  146.     /* See if user still has drawing open */
  147.     'Lock'; if RC ~= 0 then return 1
  148.     'FirstProj'; ProjPtr = Result
  149.     'ProjName' ProjPtr
  150.     if Result = "T:HOTLINKEDDRAWING" then do
  151.         'UnLock'
  152.         return 1
  153.     end
  154.     else do i=1
  155.         'NextProj' ProjPtr
  156.         if Result = 0 then do
  157.             'UnLock'
  158.             return 0
  159.         end
  160.         ProjPtr = Result
  161.         'ProjName' ProjPtr
  162.         if Result = "T:HOTLINKEDDRAWING" then do
  163.             'UnLock'
  164.             return 1
  165.         end
  166.     end
  167.     'UnLock'
  168. return
  169.