home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d7xx
/
d770
/
uedit.lha
/
Uedit
/
Kienitz.LZH
/
ue-load
/
Ue-load.doc
< prev
next >
Wrap
Text File
|
1991-03-15
|
6KB
|
122 lines
UE-LOAD.REXX
Ue-load is an ARexx program which will load some files (up to thirteen)
into Uedit, optionally marking them all read-only, optionally setting
Uedit's current directory to that where this command is given, starting
Uedit if necessary. Ue-load MUST be invoked as a rexx function rather
than as a command; to do this from a CLI use the frx command (included)
instead of the normal rx command. I suggest giving it an alias for
convenience:
alias U frx rexx:ue-load []
If you invoke Ue-load with no filenames, it will move Uedit's screen to
the front. If you include the argument "r", any files loaded will be made
read-only. An example of such a command might be "U r Config!M". If you
use the letter "c", Uedit's current directory will be changed to be the
same as that of the cli/shell where you gave the ue-load command. If
Uedit is not running ue-load will attempt to start it up first.
If Uedit is already running and you do not use the C switch, Ue-load will
test whether Uedit's current directory is different from that of the cli
where the command was invoked. If it is, any filenames sent to Uedit will
be converted into complete pathnames.
You might want to copy the script to ram: and change the above alias to be
"frx ram:ue-load []", for speed. Ue-load makes use of frx's ability to
parse arguments according to a command template. The template it uses is
"R/S,C/S,,,,,,,,,,,,,". Before using it, you have to set up the template
with the command:
rxset UE-LOAD-TEMPLATE R/S,C/S,,,,,,,,,,,,
Or you can use the SETCLIP() function inside a rexx program. Note that
the name UE-LOAD-TEMPLATE must be uppercase. There are thirteen commas in
the template after C/S ... it won't really hurt if you use fewer. If you
put Ue-load.rexx into ram:, you'll have to set the template name to
"RAM:UE-LOAD-TEMPLATE" or it won't work. Personally I just assign REXX:
to a ram: directory and copy all the rexx scripts there. Or if you just
rename Ue-load.rexx to be U.rexx, call the template "U-TEMPLATE".
Ue-load expects certain commands to be set up in Uedit's REXXCOMM file.
One, of course, is LOADFILE. Three more are CHANGEDIR, READONLY, and
optionally FRONTSCREEN. To add them, put this in REXXCOMM:
changedir 1042+0 |
readonly 396+0 |
frontscreen 1041+0 |
making sure that the number after readonly really is correct for setting
the current buffer read only in your config; 396 is shftAlt-f5. (I use
ctl-r, macronum 435.) Also add these two commands to your Config!R:
Rexx: change Uedit's current directory
<virtual-2: changedir(buf61) >
Send Uedit's screen to the front
<virtual-1: screentofront >
The above will only work for Uedit versions 2.6d and newer. With older
versions, you can use this:
Send Uedit's screen to the front
.. <virtual-1: execute(" ", "EndIf") >
That's kind of a kludge but it works okay. (I wonder when Uedit will have
a frontScreen function?) NOTE: For virtual-1 to work at all efficiently,
you must make C:Run resident and be using SetPatch from AmigaDOS 1.3.2, or
AmigaDOS 2.0 I suppose. Otherwise it will load the Run program from disk
every time you call it. You should do so anyway, because otherwise ANY
program that uses the AmigaDOS Execute() function to run other programs
will be very inefficient. Also you should either make C:EndIf resident
and use AmigaShell (resident CLI L:Shell-Seg system), or copy the EndIf
program into ramdisk and change the command in the execute function above
to "ram:EndIf". Or you could call it "ram:DoNothing" or something because
the endif program literally does nothing at all. Otherwise it will load
C:Endif from disk. With everything resident virtual-1 will run in about a
tenth of a second, moving Uedit's screen to the back and then back to the
front. REMEMBER, EVEN IF YOU NEVER MAKE ANYTHING ELSE RESIDENT, DO make
C:Run resident, and use SetPatch 1.3.2, not any earlier version.
You need one more thing for Ue-load to work: RunBack. The rexx script
starts Uedit by executing the command 'RunBack UE'. You should change the
pathname from UE to wherever you keep your Uedit executable. If you do
not have a RunBack program, I've written a very small one with no extra
features which is pure and only 468 bytes long. It only works if you
mount the NULL: device, though. It should be included with this, along
with the Null-Handler and its MountList entry. NOTE that "Run >nil: <nil:
UE" is not a good substitute for RunBack. The CLI window will be unable
to close until Uedit quits.
The loadfile command that does the main work for Ue-load can be improved
upon. Here is my version, which has the advantage that if the file
requested is already loaded, it just switches to that buffer. Also it
tends to avoid leaving a stray "NoName" buffer lying around.
the 'loadfile' macro. Usage: loadfile 'sys:myfile'
Rexx: edit given file
<virtual-j: freebuf(buf43)
insertrgn(buf43, efile, buf61, all)
movecursor(buf43, sfile)
freebuf(buf50)
insertrgn(buf50, sfile, buf43, all)
if (runkey(virtual-f6))
editbuf(buf[n50])
else if (loadfile(buf43) & !eqnum(curfile, buf0) & isempty(buf0))
freebuf(buf0)
> ..If file is already loaded under that name it will use the existing buffer
Find a file buffer by name (supply name in buf50) return buffer in n50
<virtual-f6: getmaxfiles(n54)
decnum(n54)
do (n50, 0, n54) {
if (getfilename(buf54, buf[n50])
& stringcomp(n51, buf54, buf50, 1)) {
returnTrue
}
}
returnFalse
>