home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / vsecom3.zip / WINDOW7.VRX < prev    next >
Text File  |  1994-12-27  |  8KB  |  310 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; else do
  20.         call VROptions 'ImplicitNames'
  21.     end
  22.     InitArgs.0 = argCount
  23.     if( argCount > 0 )then do i = 1 to argCount
  24.         InitArgs.i = arg( i + argOff )
  25.     end
  26.     drop calledAs argCount argOff
  27.  
  28. /*  Load the windows
  29. */
  30.     call VRInit
  31.     parse source . . spec
  32.     _VREPrimaryWindowPath = ,
  33.         VRParseFileName( spec, "dpn" ) || ".VRW"
  34.     _VREPrimaryWindow = ,
  35.         VRLoad( parent, _VREPrimaryWindowPath )
  36.     drop parent spec
  37.     if( _VREPrimaryWindow == "" )then do
  38.         call VRMessage "", "Cannot load window:" VRError(), ,
  39.             "Error!"
  40.         _VREReturnValue = 32000
  41.         signal _VRELeaveMain
  42.     end
  43.  
  44. /*  Process events
  45. */
  46.     call Init
  47.     signal on halt
  48.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  49.         _VREEvent = VREvent()
  50.         interpret _VREEvent
  51.     end
  52. _VREHalt:
  53.     _VREReturnValue = Fini()
  54.     call VRDestroy _VREPrimaryWindow
  55. _VRELeaveMain:
  56.     call VRFini
  57. exit _VREReturnValue
  58.  
  59. VRLoadSecondary:
  60.     __vrlsWait = abbrev( 'WAIT', translate(arg(2)), 1 )
  61.     if __vrlsWait then do
  62.         call VRFlush
  63.     end
  64.     __vrlsHWnd = VRLoad( VRWindow(), VRWindowPath(), arg(1) )
  65.     if __vrlsHWnd = '' then signal __vrlsDone
  66.     if __vrlsWait \= 1 then signal __vrlsDone
  67.     call VRSet __vrlsHWnd, 'WindowMode', 'Modal' 
  68.     __vrlsTmp = __vrlsWindows.0
  69.     if( DataType(__vrlsTmp) \= 'NUM' ) then do
  70.         __vrlsTmp = 1
  71.     end
  72.     else do
  73.         __vrlsTmp = __vrlsTmp + 1
  74.     end
  75.     __vrlsWindows.__vrlsTmp = VRWindow( __vrlsHWnd )
  76.     __vrlsWindows.0 = __vrlsTmp
  77.     do while( VRIsValidObject( VRWindow() ) = 1 )
  78.         __vrlsEvent = VREvent()
  79.         interpret __vrlsEvent
  80.     end
  81.     __vrlsTmp = __vrlsWindows.0
  82.     __vrlsWindows.0 = __vrlsTmp - 1
  83.     call VRWindow __vrlsWindows.__vrlsTmp 
  84.     __vrlsHWnd = ''
  85. __vrlsDone:
  86. return __vrlsHWnd
  87.  
  88. /*:VRX         __VXREXX____APPENDS__
  89. */
  90. __VXREXX____APPENDS__:
  91. /*
  92. */
  93. return
  94. /*:VRX         Fini
  95. */
  96. Fini:
  97. LIBO = VRGet( "EF_1", "Value")
  98. JCLS = VRGet( "EF_2", "Value")
  99. SOUS = VRGet( "EF_3", "Value")
  100. JOBS = VRGet( "EF_4", "Value")
  101. PWRO = VRGet( "EF_5", "Value")
  102. LIB = VRGet( "EF_6", "Value")
  103. SUB = VRGet( "EF_7", "Value")
  104. PRTO = VRGet( "EF_8", "Value")
  105.  
  106.  initfile = 'C:\VSECOM\VSECOM.INI'
  107.     x = LineOut(initfile,'DEFAULT_INIT',1)
  108.         x = LineOut(initfile,LIBO) 
  109.         x = LineOut(initfile,JCLS)
  110.         x = LineOut(initfile,SOUS)
  111.         x = LineOut(initfile,JOBS)
  112.         x = LineOut(initfile,PWRO)
  113.         x = LineOut(initfile,LIB)
  114.         x = LineOut(initfile,SUB)
  115.         x = LineOut(initfile,PRTO)
  116.         x = LineOut(initfile)
  117.         x = stream(initfile,'c','close')
  118.  
  119. retcode = LIBO","JCLS","JOBS","SOUS","PWRO","LIB","SUB","PRTO
  120.     window = VRWindow()
  121.     call VRSet window, "Visible", 0
  122.     drop window
  123. return retcode
  124.  
  125. /*:VRX         Halt
  126. */
  127. Halt:
  128.     signal _VREHalt
  129. return
  130.  
  131. /*:VRX         Init
  132. */
  133. Init:
  134. ok = VRSet( "EF_1", "Value", InitArgs.1)
  135. ok = VRSet( "EF_2", "Value", InitArgs.2)
  136. ok = VRSet( "EF_3", "Value", InitArgs.3)
  137. ok = VRSet( "EF_4", "Value", InitArgs.4)
  138. ok = VRSet( "EF_5", "Value", InitArgs.5)
  139. ok = VRSet( "EF_6", "Value", InitArgs.6)
  140. ok = VRSet( "EF_7", "Value", InitArgs.7)
  141. ok = VRSet( "EF_8", "Value", InitArgs.8)
  142.     window = VRWindow()
  143.     call VRMethod window, "CenterWindow","DESKTOP"
  144.     call VRSet window, "Visible", 1
  145.     call VRMethod window, "Activate"
  146.     drop window
  147. return
  148.  
  149. /*:VRX         LB_2_Click
  150. */
  151. LB_2_Click:
  152. LIBNAME = VRGet( "LB_2", "SelectedString")
  153. return
  154.  
  155. /*:VRX         PB_11_Click
  156. */
  157. PB_11_Click:
  158.     ok = VRSet( "EF_9", "ReadOnly", 1)
  159.     ok = VRSet( "EF_10", "ReadOnly", 1)
  160.     ok = VRSet( "EF_11", "ReadOnly", 1)
  161.     ok = VRSet( "EF_12", "ReadOnly", 1)
  162.     ok = VRSet( "EF_13", "ReadOnly", 1)
  163.     Okay = VRFileExists("C:\VSECOM\USERPROF")
  164.     If Okay = 1 then do
  165.        Okay = VRDeleteFile("C:\VSECOM\USERPROF")
  166.     end
  167.     RECCOM = "RECEIVE C:\vsecom\userprof "||TS||" (FILE=PROF"
  168.     rc = Startvio(RECCOM)
  169.     say rc
  170.     if rc = "QUIT" then return
  171.     Myfile = "C:\vsecom\userprof"
  172.     LINEIN(Myfile,1,0)
  173.     Do until LINES(Myfile) = "0"
  174.     thisline = LINEIN(Myfile)
  175.     fparm = LEFT(thisline,6)
  176.     call xout
  177.     end
  178.     fparm = LINEOUT(Myfile) /* close the file */
  179.     ok = VRSet( "EF_9", "ReadOnly", 1)
  180.     ok = VRSet( "EF_10", "ReadOnly", 1)
  181.     ok = VRSet( "EF_11", "ReadOnly", 1)
  182.     ok = VRSet( "EF_12", "ReadOnly", 1)
  183.  
  184.    /*  E.EXE " C:\userprof" */
  185. return
  186. xout:
  187. Select
  188.     when fparm = "TRMID " then do
  189.     fparm = SUBWORD(thisline,2,4)
  190.     ok = VRSet( "EF_12", "Value", fparm)
  191.     return
  192.     end 
  193.     when fparm = "UID   " then do
  194.     fparm = SUBWORD(thisline,2,8)
  195.     LUSER = fparm
  196.     ok = VRSet( "EF_10", "Value", fparm)
  197.     return
  198.     end
  199.     when fparm = "LIBACC" then do
  200.     fparm = SUBWORD(thisline,1,6)
  201.     position = VRMethod( "LB_1", "AddString",fparm, )
  202.     return 
  203.     end
  204.     when fparm = "POWACC" then do
  205.     fparm = SUBWORD(thisline,1,6)
  206.     position = VRMethod( "LB_1", "AddString",fparm, )
  207.     return
  208.     end  
  209.     when fparm = "POWALL" then do
  210.     fparm = SUBWORD(thisline,1,6)
  211.     position = VRMethod( "LB_1", "AddString",fparm, )
  212.     return
  213.     end
  214.     when fparm = "SUBMIT" then do
  215.     fparm = SUBWORD(thisline,1,6)
  216.     position = VRMethod( "LB_1", "AddString",fparm, )
  217.     return
  218.     end
  219.     when fparm = "SYSID " then do
  220.     fparm = SUBWORD(thisline,2,8)
  221.     ok = VRSet( "EF_13", "Value", fparm)
  222.     return
  223.     end
  224.     when fparm = "UTYP  " then do
  225.     fparm = SUBWORD(thisline,2,1)
  226.     ok = VRSet( "EF_11", "Value", fparm)
  227.     return
  228.     end
  229.     when fparm = "SCLASS" then do
  230.     fparm = SUBWORD(thisline,2,1)
  231.     ok = VRSet( "EF_14", "Value", fparm)
  232.     return
  233.     end
  234.     when fparm = "VER" then do
  235.     fparm = SUBWORD(thisline,2,10)
  236.     ok = VRSet( "EF_9", "Value", fparm)
  237.     return
  238.     end
  239.     when fparm = "LIB   " then do
  240.     call getlibs
  241.     return
  242.     end
  243.     when fparm = "HTF   " then do
  244.     fparm = SUBWORD(thisline,1,6)
  245.     position = VRMethod( "LB_1", "AddString",fparm, )
  246.     return
  247.     end
  248. otherwise nop
  249. return
  250. getlibs:
  251. startl = 10
  252. fparm = SUBSTR(thisline,startl,7)
  253. position = VRMethod( "LB_2", "AddString",fparm, )
  254.     do until fparm = "       "
  255.     startl = startl + 7
  256.     fparm = SUBSTR(thisline,startl,7)
  257.     if fparm = "       " then return
  258.     position = VRMethod( "LB_2", "AddString",fparm, )
  259.     end
  260. return
  261. /*:VRX         Quit
  262. */
  263. Quit:
  264.     window = VRWindow()
  265.     call VRSet window, "Shutdown", 1
  266.     drop window
  267. return
  268.  
  269. /*:VRX         Startvio
  270. */
  271. Startvio:procedure
  272. parse arg command
  273. erase "c:\vsecom\vsestat.fil"
  274. "start /win/c c:\vsecom\runvse.cmd" command "<con >con"
  275. /*"start /win/c c:\vsecom\runvse.cmd" command*/ 
  276. SPINNUM = 0
  277. RC = ""
  278. DO FOREVER
  279.     call SysSleep 2
  280.     exists = VRFileExists("C:\vsecom\vsestat.fil")
  281.  
  282.     if exists = 1 then do
  283.     LEAVE
  284.     end
  285.     else do
  286.     SPINNUM = SPINNUM + 1
  287.     end
  288.  
  289.     if SPINNUM = 5 then do
  290.     SPINNUM = 0
  291.     rc = Window8(VRWindow())
  292.     end
  293.  
  294.     if rc = "QUIT" then do
  295.     LEAVE
  296.     end
  297. end
  298.  
  299. return rc    
  300.     
  301.  
  302.  
  303.  
  304. /*:VRX         Window7_Close
  305. */
  306. Window7_Close:
  307.     call Quit
  308. return
  309.  
  310.