home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vsecom3.zip / WINDOW4.VRX < prev    next >
Text File  |  1994-12-15  |  5KB  |  226 lines

  1. /*:VRX         Main
  2. */
  3. /*  Main
  4. */
  5. Main:
  6. /*  Process the arguments.
  7.     Get the parent window.
  8. */
  9.     parse source . calledAs .
  10.     parent = ""
  11.     argCount = arg()
  12.     argOff = 0
  13.     if( calledAs \= "COMMAND" )then do
  14.         if argCount >= 1 then do
  15.             parent = arg(1)
  16.             argCount = argCount - 1
  17.             argOff = 1
  18.         end
  19.     end
  20.     InitArgs.0 = argCount
  21.     if( argCount > 0 )then do i = 1 to argCount
  22.         InitArgs.i = arg( i + argOff )
  23.     end
  24.     drop calledAs argCount argOff
  25.  
  26. /*  Load the windows
  27. */
  28.     call VRInit
  29.     parse source . . spec
  30.     _VREPrimaryWindowPath = ,
  31.         VRParseFileName( spec, "dpn" ) || ".VRW"
  32.     _VREPrimaryWindow = ,
  33.         VRLoad( parent, _VREPrimaryWindowPath )
  34.     drop parent spec
  35.     if( _VREPrimaryWindow == "" )then do
  36.         call VRMessage "", "Cannot load window:" VRError(), ,
  37.             "Error!"
  38.         _VREReturnValue = 32000
  39.         signal _VRELeaveMain
  40.     end
  41.  
  42. /*  Process events
  43. */
  44.     call Init
  45.     signal on halt
  46.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  47.         _VREEvent = VREvent()
  48.         interpret _VREEvent
  49.     end
  50. _VREHalt:
  51.     _VREReturnValue = Fini()
  52.     call VRDestroy _VREPrimaryWindow
  53. _VRELeaveMain:
  54.     call VRFini
  55. exit _VREReturnValue
  56.  
  57. VRLoadSecondary: procedure
  58.     name = arg( 1 )
  59.  
  60.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  61.     call VRMethod window, "CenterWindow"
  62.     call VRSet window, "Visible", 1
  63.     call VRMethod window, "Activate"
  64. return window
  65.  
  66. /*:VRX         Fini
  67. */
  68. Fini:
  69.     window = VRWindow()
  70.     call VRSet window, "Visible", 0
  71.     drop window
  72. return 0
  73.  
  74. /*:VRX         Halt
  75. */
  76. Halt:
  77.     signal _VREHalt
  78. return
  79.  
  80. /*:VRX         Init
  81. */
  82. Init:
  83.     call RxFuncAdd 'SysSleep' , 'RexxUtil', 'SysSleep'
  84.     TS = "A:"
  85.     window = VRWindow()
  86.     call VRMethod window, "CenterWindow","DESKTOP"
  87.     call VRSet window, "Visible", 1
  88.     call VRMethod window, "Activate"
  89.     drop window
  90. return
  91.  
  92. /*:VRX         PB_12_Click
  93. */
  94. PB_12_Click:
  95.     MEMNAME = "Lock Member?"
  96.     values = Window2( VRWindow(), "LOCK",LIB,SUB,MEMNAME)
  97.     if values = "" then return
  98.     parse var values CHKPRT "," CHKVIEW "," LIBFILE "," LIB "," SUB "," MEMNAME
  99.     RECCOM = "RECEIVE "||LIBFILE||" "TS||" (FILE=LCMD) ACC S="||LIB||"."||SUB" ; LOCK "||MEMNAME||" LOCKID="LUSER
  100.     rc = Startvio(RECCOM)
  101.     if rc = "QUIT" then return
  102.     if CHKPRT = "1" then COPY LIBFILE " LPT1:"
  103.     if CHKVIEW = "1" then E LIBFILE
  104.  
  105.  
  106. return
  107.  
  108. /*:VRX         PB_13_Click
  109. */
  110. PB_13_Click:
  111.     MEMNAME = "UNlock Member?"
  112.     values = Window2( VRWindow(), "UNLOCK",LIBNAME,SUBNAME,MEMNAME)
  113.     if values = "" then return
  114.     parse var values CHKPRT "," CHKVIEW "," LIBFILE "," LIBNAME "," SUBNAME "," MEMNAME
  115.     RECCOM = "RECEIVE "||LIBFILE||" "TS||" (FILE=LCMD) ACC S="||LIBNAME||"."||SUBNAME" ; UNLOCK "||MEMNAME||" LOCKID="LUSER
  116.     rc = Startvio(RECCOM)
  117.     if rc = "QUIT" then return
  118.     if CHKPRT = "1" then COPY LIBFILE " LPT1:"
  119.     if CHKVIEW = "1" then E LIBFILE
  120.  
  121.   
  122.  
  123. return
  124.  
  125. /*:VRX         PB_14_Click
  126. */
  127. PB_14_Click:
  128.     values = Window13( VRWindow())
  129.     if values = "" then return
  130.     trtype = values
  131.     if trtype = "OTH" then do
  132.         SRcom = " "
  133.         button.0 = 2
  134.         button.1 = "OK"
  135.         button.2 = "CANCEL"
  136.         call VRPrompt VRWindow(),"ENTER A SEND/RECEIVE COMMAND:", "SRcom", "EXECUTE AN EXPLICIT SEND/RECEIVE COM STRING", "button.",1,2
  137.         if result = 2 then return
  138.         rc = Startvio(SRcom)
  139.         return
  140.     end
  141.     trtype = "SEND"
  142.     values = Window14( VRWindow(),trtype)
  143.     if values = "" then return
  144.     parse var values part1 "," part2 "," part3
  145.     RECCOM = "SEND "||part1||" "TS||" "||part2||" "||part3
  146.     say reccom
  147.     rc = Startvio(RECCOM)
  148.     if rc = "QUIT" then return
  149.     return
  150.   
  151. /*:VRX         PB_15_Click
  152. */
  153. PB_15_Click:
  154.     values = Window13( VRWindow())
  155.     if values = "" then return
  156.     trtype = values
  157.     if trtype = "OTH" then do
  158.         SRcom = " "
  159.         button.0 = 2
  160.         button.1 = "OK"
  161.         button.2 = "CANCEL"
  162.         call VRPrompt VRWindow(),"ENTER A SEND/RECEIVE COMMAND:", "SRcom", "EXECUTE AN EXPLICIT SEND/RECEIVE COM STRING", "button.",1,2
  163.         if result = 2 then return
  164.         rc = Startvio(SRcom)
  165.         return
  166.     end
  167.     trtype = "REC"
  168.     values = Window14( VRWindow(),trtype)
  169.     if values = "" then return
  170.     parse var values part1 "," part2 "," part3
  171.     RECCOM = "RECEIVE "||part1||" "TS||" "||part2||" "||part3
  172.     say reccom
  173.     rc = Startvio(RECCOM)
  174.     if rc = "QUIT" then return
  175. return
  176.   
  177.  
  178. /*:VRX         Quit
  179. */
  180. Quit:
  181.     window = VRWindow()
  182.     call VRSet window, "Shutdown", 1
  183.     drop window
  184. return
  185.  
  186. /*:VRX         Startvio
  187. */
  188. Startvio:procedure
  189. parse arg command
  190. erase "c:\vsecom\vsestat.fil"
  191. "start /win/c c:\vsecom\runvse.cmd" command "<con >con"
  192. /*"start /win/c c:\vsecom\runvse.cmd" command*/ 
  193. SPINNUM = 0
  194. RC = ""
  195. DO FOREVER
  196.     call SysSleep 2
  197.     exists = VRFileExists("C:\vsecom\vsestat.fil")
  198.  
  199.     if exists = 1 then do
  200.     LEAVE
  201.     end
  202.     else do
  203.     SPINNUM = SPINNUM + 1
  204.     end
  205.  
  206.     if SPINNUM = 5 then do
  207.     SPINNUM = 0
  208.     rc = Window7(VRWindow())
  209.     end
  210.  
  211.     if rc = "QUIT" then do
  212.     LEAVE
  213.     end
  214. end
  215.  
  216. return rc    
  217.     
  218.  
  219.  
  220. /*:VRX         Window1_Close
  221. */
  222. Window1_Close:
  223.     call Quit
  224. return
  225.  
  226.