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

  1. /* $VER: SendtoPageLiner.rexx 1.5a (21.10.96)
  2.    Copyright 1996 SoftLogik Publishing Corporation
  3.    May not be distributed without SoftLogik Publishing Corporation's express written permission */
  4.  
  5. OPTIONS RESULTS
  6. TRACE OFF
  7.  
  8. /* Make sure rexx support is opened */
  9. IF ~SHOW('L','rexxsupport.library') THEN
  10.    CALL ADDLIB('rexxsupport.library',0,-30)
  11.  
  12. ADDRESS 'PAGESTREAM'
  13.  
  14. /* If text is not selected, select the current article */
  15. getcursor characterstart sID characterend eID
  16. if sID=eID then 'selecttext all'
  17.  
  18. /* Export the article to a temp file */
  19. 'lockinterface true'
  20. 'exporttext file t:HotLinkedArticle filter ascii textcode PageStream status force'
  21.  
  22. /* Get the start date and time info */
  23. sTemp = statef('t:HotLinkedArticle')
  24. Parse VAR sTemp dum dum dum dum iSDays iSMins iSTicks .
  25.  
  26. 'refresh wait'
  27.  
  28. /* set the default PageLiner path */
  29. plpath='PageStream3:PageLiner'
  30. preffile='PageStream3:SendtoPageLiner.prefs'
  31.  
  32. /* If PageLiner doesn't exist in the default path, check SendtoPageLiner.prefs */
  33. if ~exists(plpath) then do
  34.     if open(.ifile, preffile, 'R') then do
  35.         plpath=readln(.ifile)
  36.         call close(.ifile)
  37.         askuser='no'
  38.         end
  39.     else do
  40.         askuser='yes'
  41.     end
  42.     /* If PageLiner doesn't exist in the set pref path, ask the user where it is */
  43.     if ~exists(plpath) | askuser='yes' then do
  44.         getfile TITLE "'Please locate PageLiner'" load path "'PageStream3:'" file 'PageLiner' posbutton 'Ok' negbutton 'Cancel'
  45.         if RC=10 then signal cancel
  46.         plpath=result
  47.         if open(.ifile, preffile, 'W') then do
  48.             call writeln(.ifile, plpath)
  49.             call close(.ifile)
  50.         end
  51.     end
  52. end
  53.  
  54.  
  55. /* Run PageLiner */
  56. ADDRESS COMMAND
  57. 'run >nil:' PLpath||' PUBSCREEN=PAGESTREAM3'
  58.  
  59. /* Wait until the ARexx port shows up */
  60. do 20
  61.     if ~show(P, 'PAGELINER') then call delay(50)
  62. end
  63.  
  64. /* If the ARexx port didn't show up, alert the user and exit */
  65. if ~show(P, 'PAGELINER') then do
  66.     ADDRESS 'PAGESTREAM'
  67.     allocarexxrequester '"Send to Editor Error!"' 368 59
  68.     reqhandle=result
  69.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  70.         Exithandle=result
  71.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'PageLiner could not be started.'"
  72.     doarexxrequester reqhandle
  73.     freearexxrequester reqhandle
  74.     'refresh continue'
  75.     'lockinterface false'
  76.     EXIT
  77. end
  78.  
  79. ADDRESS 'PAGELINER'
  80. 'open t:HotLinkedArticle'
  81. 'cursor down'
  82.  
  83. /* Wait for the user to finish in PageLiner */
  84. do forever
  85.     if show(P, 'PAGELINER') then do
  86.         'getarticle t:hotlinkedarticle'
  87.         if rc=0 then call delay(50)
  88.         else signal update
  89.     end
  90.     else signal update
  91. end
  92.  
  93. /* Update PageStream and exit */
  94. UPDATE:
  95. ADDRESS 'PAGESTREAM'
  96.     'screentofront'
  97.     'revealwindow current'
  98.  
  99.     /* Get the end date and time info */
  100.     sTemp = statef('t:HotLinkedArticle')
  101.     Parse VAR sTemp dum dum dum dum iEDays iEMins iETicks .
  102.  
  103.     /* If the article hasn't changed, don't update pgs */
  104.     if iSDays=iEDays & iSMins=iEMins & iSTicks=iETicks then signal cancel
  105.  
  106.     'inserttext file t:HotLinkedArticle filter ascii textcode PageStream convertquote false convertdash true'
  107.  
  108.     /* deselect the text if rquired */
  109.     if sID=eID then selecttext none
  110. signal cancel
  111.  
  112. CANCEL:
  113. ADDRESS 'PAGESTREAM'
  114. 'refresh continue'
  115. 'lockinterface false'
  116. ADDRESS COMMAND
  117. 'delete t:HotLinkedArticle >NIL:'
  118. EXIT
  119.