[comp.lang.rexx] Arexx layerting shells

Steven.Ayscue@bbs.acs.unc.edu (Steven Ayscue) (04/17/91)

/* Layersh /*
/* Rexx program to layer newwsh shells                      */
/* by Steven.Ayscue@bbs.acs.unc.edu                         */
/*                                                          */          
/* It can be modified to work with other shells besides     */
/* Wshell quite easily if they use environment variables    */
/* to get the shell window position. Use this with Popcli or*/
/* MachIII as a launcher for new shell windows.             */
/*                                                          */
/* The coordinates and titlename of the shellwindow env var */
/* are to suit my own taste (towards bottom half of a hi-res*/
/* screen) and can be modified at will to suit.             */
/* This program is in response to the usenet post about     */
/* some such machine layering new command line (shell)      */
/* windows in a nice fashion.                               */
/*                                                          */
/* Notice that this file modifies the environment  variable */
/* shellwindow. I have my env: directory copied to and      */
/* assigned to ram: so the original shellwindow on disk is  */
/* not altered. The effect is that on a cold boot, the      */
/* shellwindow env variable is always loaded from the upper */
/* left layer position.                                     */
/*                                                          */
/* Will somebody please streamline this for me? I am a      */
/* beginner at this rexx stuff...it just seems redundent    */
/* in a few places here and there; but it works!            */
/*                                                          */
/* Read in existing shellwindow env variable and assign to  */
/* an rexx script varible to work on.                       */
OPEN('Shellpos','ENV:Shellwindow',Read)
    line = READLN('Shellpos')
CLOSE('Shellpos')
/* get existing coordinates of top left corner of shellwindow */
    coord1 = substr(line,5,3)
    coord2 = substr(line,9,3)
/* Fixup new coordinates                               */
/* X-step is ten, Y-step is 12 for a nice layer effect */
    coord1 = (coord1+10)
    coord2 = (coord2+12)
/* These IFS pad the first coordinates with Zeros so */
/* the program can deal with the low numbers in the x coordinate */
/* position of my shell window.
      if coord1 <=99
	then coord1 = "0"||coord1
      endif
      if coord1 <= 9
	then coord1 = "0"||coord1
      endif
/* My original Env variable for my shellwindow              */
/* is CON:003/280/595/143/Wshell/c/5 which comes up near    */
/* the bottom of my hi-res WorkBench screen.                */
/* These IFS that follow reset the shellwindow ENV variable */
/* to the original position after 5 new Wshells opened.    */
/* been layerd. ( I have the X coordinate steps set to */
/* ten in above code)					    */
      if coord1 >60
	then coord2 = "280"
      endif
      if coord1 >60
	then coord1 = "003"
      endif
/* Put new coordinates into shellwindow env variable format  */
line = ('CON:'||coord1||'/'||coord2||'/595/143/Wshell/c/5')
/* Write out new shellwindow env variable to ENV:shellwindow */
OPEN('Shellpos','ENV:Shellwindow',Write)
Writech('Shellpos',line)
Close('Shellpos')
/* execute newwsh program to launch new Wshell */
Newwsh
/* End of program Layersh */

No fancy sig yet....
Steven.Ayscue@bbs.acs.unc.edu

--
=============================================================================
	Extended Bulletin Board Service, Research & Development
Office of Information Technology, University of North Carolina at Chapel Hill
	      internet: bbs.acs.unc.edu or 128.109.157.30