home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d07xx / d0770.lha / Uedit / Kienitz.LZH / ue-load / Ue-load.doc < prev    next >
Text File  |  1991-03-15  |  6KB  |  122 lines

  1.  
  2.                                 UE-LOAD.REXX
  3.  
  4.    Ue-load is an ARexx program which will load some files (up to thirteen)
  5.    into Uedit, optionally marking them all read-only, optionally setting
  6.    Uedit's current directory to that where this command is given, starting
  7.    Uedit if necessary.  Ue-load MUST be invoked as a rexx function rather
  8.    than as a command; to do this from a CLI use the frx command (included)
  9.    instead of the normal rx command.  I suggest giving it an alias for
  10.    convenience:
  11.  
  12. alias U frx rexx:ue-load []
  13.  
  14.    If you invoke Ue-load with no filenames, it will move Uedit's screen to
  15.    the front.  If you include the argument "r", any files loaded will be made
  16.    read-only.  An example of such a command might be "U r Config!M".  If you
  17.    use the letter "c", Uedit's current directory will be changed to be the
  18.    same as that of the cli/shell where you gave the ue-load command.  If
  19.    Uedit is not running ue-load will attempt to start it up first.
  20.  
  21.    If Uedit is already running and you do not use the C switch, Ue-load will
  22.    test whether Uedit's current directory is different from that of the cli
  23.    where the command was invoked.  If it is, any filenames sent to Uedit will
  24.    be converted into complete pathnames.
  25.  
  26.    You might want to copy the script to ram: and change the above alias to be
  27.    "frx ram:ue-load []", for speed.  Ue-load makes use of frx's ability to
  28.    parse arguments according to a command template.  The template it uses is
  29.    "R/S,C/S,,,,,,,,,,,,,".  Before using it, you have to set up the template
  30.    with the command:
  31.  
  32. rxset UE-LOAD-TEMPLATE R/S,C/S,,,,,,,,,,,,
  33.  
  34.    Or you can use the SETCLIP() function inside a rexx program.  Note that
  35.    the name UE-LOAD-TEMPLATE must be uppercase.  There are thirteen commas in
  36.    the template after C/S ... it won't really hurt if you use fewer.  If you
  37.    put Ue-load.rexx into ram:, you'll have to set the template name to
  38.    "RAM:UE-LOAD-TEMPLATE" or it won't work.  Personally I just assign REXX:
  39.    to a ram: directory and copy all the rexx scripts there.  Or if you just
  40.    rename Ue-load.rexx to be U.rexx, call the template "U-TEMPLATE".
  41.  
  42.    Ue-load expects certain commands to be set up in Uedit's REXXCOMM file.
  43.    One, of course, is LOADFILE.  Three more are CHANGEDIR, READONLY, and
  44.    optionally FRONTSCREEN.  To add them, put this in REXXCOMM:
  45.  
  46. changedir       1042+0 |
  47. readonly        396+0 |
  48. frontscreen     1041+0 |
  49.  
  50.    making sure that the number after readonly really is correct for setting
  51.    the current buffer read only in your config; 396 is shftAlt-f5.  (I use
  52.    ctl-r, macronum 435.)  Also add these two commands to your Config!R:
  53.  
  54. Rexx:  change Uedit's current directory
  55. <virtual-2:     changedir(buf61) >
  56.  
  57. Send Uedit's screen to the front
  58. <virtual-1:     screentofront >
  59.  
  60.    The above will only work for Uedit versions 2.6d and newer.  With older
  61.    versions, you can use this:
  62.  
  63. Send Uedit's screen to the front
  64. .. <virtual-1:     execute(" ", "EndIf") >
  65.  
  66.    That's kind of a kludge but it works okay.  (I wonder when Uedit will have
  67.    a frontScreen function?)  NOTE:  For virtual-1 to work at all efficiently,
  68.    you must make C:Run resident and be using SetPatch from AmigaDOS 1.3.2, or
  69.    AmigaDOS 2.0 I suppose.  Otherwise it will load the Run program from disk
  70.    every time you call it.  You should do so anyway, because otherwise ANY
  71.    program that uses the AmigaDOS Execute() function to run other programs
  72.    will be very inefficient.  Also you should either make C:EndIf resident
  73.    and use AmigaShell (resident CLI L:Shell-Seg system), or copy the EndIf
  74.    program into ramdisk and change the command in the execute function above
  75.    to "ram:EndIf".  Or you could call it "ram:DoNothing" or something because
  76.    the endif program literally does nothing at all.  Otherwise it will load
  77.    C:Endif from disk.  With everything resident virtual-1 will run in about a
  78.    tenth of a second, moving Uedit's screen to the back and then back to the
  79.    front.  REMEMBER, EVEN IF YOU NEVER MAKE ANYTHING ELSE RESIDENT, DO make
  80.    C:Run resident, and use SetPatch 1.3.2, not any earlier version.
  81.  
  82.    You need one more thing for Ue-load to work:  RunBack.  The rexx script
  83.    starts Uedit by executing the command 'RunBack UE'.  You should change the
  84.    pathname from UE to wherever you keep your Uedit executable.  If you do
  85.    not have a RunBack program, I've written a very small one with no extra
  86.    features which is pure and only 468 bytes long.  It only works if you
  87.    mount the NULL: device, though.  It should be included with this, along
  88.    with the Null-Handler and its MountList entry.  NOTE that "Run >nil: <nil:
  89.    UE" is not a good substitute for RunBack.  The CLI window will be unable
  90.    to close until Uedit quits.
  91.  
  92.    The loadfile command that does the main work for Ue-load can be improved
  93.    upon.  Here is my version, which has the advantage that if the file
  94.    requested is already loaded, it just switches to that buffer.  Also it
  95.    tends to avoid leaving a stray "NoName" buffer lying around.
  96.  
  97. the 'loadfile' macro.  Usage: loadfile 'sys:myfile'
  98. Rexx: edit given file
  99. <virtual-j:    freebuf(buf43)
  100.         insertrgn(buf43, efile, buf61, all)
  101.         movecursor(buf43, sfile)
  102.         freebuf(buf50)
  103.         insertrgn(buf50, sfile, buf43, all)
  104.         if (runkey(virtual-f6))
  105.             editbuf(buf[n50])
  106.         else if (loadfile(buf43) & !eqnum(curfile, buf0) & isempty(buf0))
  107.             freebuf(buf0)
  108. >  ..If file is already loaded under that name it will use the existing buffer
  109.  
  110. Find a file buffer by name (supply name in buf50) return buffer in n50
  111. <virtual-f6:    getmaxfiles(n54)
  112.                 decnum(n54)
  113.                 do (n50, 0, n54) {
  114.                     if (getfilename(buf54, buf[n50])
  115.                                 & stringcomp(n51, buf54, buf50, 1)) {
  116.                         returnTrue
  117.                     }
  118.                 }
  119.                 returnFalse
  120. >
  121.  
  122.