home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vsecom3.zip / WINDOW5.VRX < prev    next >
Text File  |  1995-09-18  |  4KB  |  175 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.     FileO = InitArgs.1
  84.     PrintO = InitArgs.2
  85.     call RxFuncAdd 'SysSleep' , 'RexxUtil', 'SysSleep'
  86.     window = VRWindow()
  87.     call VRMethod window, "CenterWindow","DESKTOP"
  88.     call VRSet window, "Visible", 1
  89.     call VRMethod window, "Activate"
  90.     drop window
  91. return
  92.  
  93. /*:VRX         PB_19_Click
  94. */
  95. PB_19_Click:
  96.     FileO = FileO||"\PWROUT"
  97.     Okay = VRFileExists(FileO)
  98.     If Okay = 1 then do
  99.        Okay = VRDeleteFile(FileO)
  100.     end
  101.  
  102.     usercom = " "
  103.     button.0 = 2
  104.     button.1 = "OK"
  105.     button.2 = "CANCEL"
  106.     call VRPrompt VRWindow(),"Enter A VSE POWER command:", "usercom", "EXECUTE PWR", "button.",1,2
  107.     if result = 2 then return
  108.     RECCOM = "RECEIVE "||FileO||" TS (FILE=PCMD) "||usercom
  109.     rc = Startvio(RECCOM)
  110.     if rc = "QUIT" then return
  111.     E FileO
  112.     
  113.     return
  114.  
  115. /*:VRX         PB_21_Click
  116. */
  117. PB_21_Click:
  118.     SRcom = " "
  119.     button.0 = 2
  120.     button.1 = "OK"
  121.     button.2 = "CANCEL"
  122.     call VRPrompt VRWindow(),"ENTER A SEND/RECEIVE COMMAND:", "SRcom", "EXECUTE AN EXPLICIT SEND/RECEIVE COMMAND STRING", "button.",1,2
  123.     if result = 2 then return
  124.     rc = Startvio(SRcom)
  125.     return
  126.  
  127. /*:VRX         Quit
  128. */
  129. Quit:
  130.     window = VRWindow()
  131.     call VRSet window, "Shutdown", 1
  132.     drop window
  133. return
  134.  
  135. /*:VRX         Startvio
  136. */
  137. Startvio:procedure
  138. parse arg command
  139. erase "c:\vsecom\vsestat.fil"
  140. "start /win/c c:\vsecom\runvse.cmd" command "<con >con"
  141. /*"start /win/c c:\vsecom\runvse.cmd" command*/ 
  142. SPINNUM = 0
  143. RC = ""
  144. DO FOREVER
  145.     call SysSleep 2
  146.     exists = VRFileExists("C:\vsecom\vsestat.fil")
  147.  
  148.     if exists = 1 then do
  149.     LEAVE
  150.     end
  151.     else do
  152.     SPINNUM = SPINNUM + 1
  153.     end
  154.  
  155.     if SPINNUM = 5 then do
  156.     SPINNUM = 0
  157.     rc = Window8(VRWindow())
  158.     end
  159.  
  160.     if rc = "QUIT" then do
  161.     LEAVE
  162.     end
  163. end
  164.  
  165. return rc    
  166.     
  167.  
  168.  
  169. /*:VRX         Window1_Close
  170. */
  171. Window1_Close:
  172.     call Quit
  173. return
  174.  
  175.