home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d7xx
/
d770
/
uedit.lha
/
Uedit
/
Jenkins2.LZH
/
Do_A_Directory
< prev
next >
Wrap
Text File
|
1991-04-08
|
3KB
|
86 lines
Do_A_Directory
=============================================================================
COPYRIGHT 1991
Robert A. Jenkins, Ph.D.
22901 Shagbark Lane
Miller Woods, IL 60411
(708) 758-0344
All Rights Reserved
Rick Stiles may distribute it as he pleases.
=============================================================================
There are lots of times that I want to do something to every file in a
directory. It is a pain to load every one, one by one. And it is a pain to
create a listing and then create a learned sequence which will load each file
one by one, doing something to each one. So I wrote this little command that
will load the files and then execute the current learned sequence on each one.
Requests directorypath, lists all files in the directory, then loads each file
in turn and on each file it runs the current learned sequence. The loaded
file is curFile when ctl-r is run.
You will be asked if you want to be asked YesNo at critical points (when the
list is done, and before each file is run). If the directory contains some
files you do not want to run the learned sequence on, and you ask for YesNo
you can tell it to skip that file when it loads it.
Remember, the cursor is placed at sFile when a file is loaded.
The learned sequence can move to another file because the command keeps track
of the buffer number of the file that was loaded. However, some things do not
work right in Uedit when you do that so be careful.
buf57 = input dirpath
buf55 = DOS LIST QUICK command
buf42 = list of files
n1 = buffer # of loaded file
=============================================================================
Run current learned sequence on all files in directory
<shftAltCtl-a:
equateNum(n99,1)
if (!askYesNo("Ask YesNo at critical points (or just run)?")) equateNum(n99,0)
putMsg("Input dirpath containing files:")
inputString(buf57) ..show last one
freeBuf(buf55)
insertRgn(buf55,sFile,buf57,all)
insertRgn(buf55,sFile,"LIST ",all)
insertRgn(buf55,eFile," QUICK ",all)
freeBuf(buf42)
execute (buf42,buf55)
editBuf(buf42)
runKey(ctl-d) ..delete "Directory...." line
runKey(alt-2) ..del trailing white
moveCursor(curFile,eFile)
runKey(normal-bs) ..del EOL on last line
runKey(ctl-d) ..del #files, #blocks line
runKey(normal-bs) ..del EOL on last line
moveCursor(curFile,sFile)
refreshDisplay
if (!askYesNo("Proceed with this file list?")) returnFalse
while (nothing) {
..get a file name
editBuf(buf42)
if (is(curFile,eFile)) return
if (!is(curFile,sLine)) moveCursor(curFile,sLine)
equateLoc(buf42,sHilite,atCursor)
moveCursor(buf42,eLine)
equateLoc(buf42,eHilite,atCursor)
..alertUser("got name of file")..debug
..create pathname
freeBuf(buf55)
insertRgn(buf55,sFile,buf57,all)
if (!is(buf55,":")) insertChar(buf55,"/")
insertRgn(buf55,eFile,buf42,hilite)
loadFile(buf55)
equateNum(n1,curFile) ..record buf# to delete later
if (eqNum(n99,1)) { ..show alerts
if (askYesNo("Run learned sequence with this curFile?"))
runKey(ctl-r) } ..run the learned sequence
else
runKey(ctl-r)
freeBuf(buf[n1])
if (!moveCursor(buf42,downLine)) returnTrue } ..exit
>Saturday 23-Feb-91 21:12:09