home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / rdb084r2.zip / txtimg.nrx < prev    next >
Text File  |  1997-03-17  |  2KB  |  75 lines

  1. /* A simple plug-in template */
  2.  
  3. /* Needed */
  4. rHowManyFld = Rexx
  5. rHowManyRec = Rexx
  6. rFieldName = Rexx[]
  7. rFieldValue = Rexx[,]
  8. iCount = int
  9. iCount2 = int
  10. iCount3 = int
  11. rx = RXFile()
  12.  
  13. /* 
  14.   these three (rx2, rtime, pr2) are optional: needed only 
  15.   for _this_ plugin.
  16.   (Needed to communicate with TGShow.class)
  17. */
  18. rx2 = RXFile()
  19. rtime = Runtime
  20. pr2 = Process
  21.  
  22. /* Now the code needed */
  23. rHowManyFld = rx.linein() /* How many fields? */
  24. rFieldName = Rexx[rHowManyFld + 1]
  25.  
  26. loop iCount = 1 to rHowManyFld
  27.  rFieldName[iCount] = rx.linein() /* Get field names */
  28. end
  29.  
  30. rHowManyRec = rx.linein() /* How many records? */
  31. rFieldValue = Rexx[rHowManyFld + 1, rHowManyRec + 1]
  32.  
  33. loop iCount = 1 to rHowManyRec /* Records */
  34.  loop iCount2 = 1 to rHowManyFld
  35.   rFieldValue[iCount2, iCount] = rx.linein()
  36.  end
  37. end
  38.  
  39. /* 
  40.   Here it is the code which links to the running applet
  41.   and tells it where to find the images/texts.
  42. */
  43.  
  44. /* Let's find where is (if there /is/) the IMAGE field */
  45. iCount2 = 0
  46. loop iCount = 1 to rHowManyFld
  47.  if (((rFieldName[iCount]).strip()).left(5)).upper() = 'IMAGE' then
  48.   iCount2 = iCount
  49. end
  50. if iCount2 = 0 then exit
  51.  
  52. /* Let's find where is (if there /is/) the TEXT field */
  53. iCount3 = 0
  54. loop iCount = 1 to rHowManyFld
  55.  if (((rFieldName[iCount]).strip()).left(4)).upper() = 'TEXT' then
  56.   iCount3 = iCount
  57. end
  58. if iCount3 = 0 then exit
  59.  
  60. loop iCount = 1 to rHowManyRec -- Repeat for every record received.
  61.  /* fire up TGShow */
  62.  rtime = Runtime.getRuntime()
  63.  do
  64.   pr2 = rtime.exec("applet TGShow.htm")
  65.  catch NullPointerException
  66.   exit
  67.  end
  68.  
  69.  rx2.attachtooutputstream(pr2.getOutputStream())
  70.  rx2.attachtoinputstream(pr2.getInputStream())
  71.  
  72.  rx2.lineout(rFieldValue[iCount2, iCount]) -- Send the image file name
  73.  rx2.lineout(rFieldValue[iCount3, iCount]) -- Send the text file name
  74. end
  75.