home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d07xx / d0770.lha / Uedit / Jenkins2.LZH / Do_A_Directory < prev    next >
Text File  |  1991-04-08  |  3KB  |  86 lines

  1. Do_A_Directory
  2.  
  3. =============================================================================
  4. COPYRIGHT 1991
  5. Robert A. Jenkins, Ph.D.
  6. 22901 Shagbark Lane
  7. Miller Woods, IL 60411
  8. (708) 758-0344
  9. All Rights Reserved
  10. Rick Stiles may distribute it as he pleases.
  11.  
  12. =============================================================================
  13. There are lots of times that I want to do something to every file in a
  14. directory.  It is a pain to load every one, one by one.  And it is a pain to
  15. create a listing and then create a learned sequence which will load each file
  16. one by one, doing something to each one.  So I wrote this little command that
  17. will load the files and then execute the current learned sequence on each one.
  18.  
  19. Requests directorypath, lists all files in the directory, then loads each file
  20. in turn and on each file it runs the current learned sequence.  The loaded
  21. file is curFile when ctl-r is run.  
  22.  
  23. You will be asked if you want to be asked YesNo at critical points (when the
  24. list is done, and before each file is run).  If the directory contains some
  25. files you do not want to run the learned sequence on, and you ask for YesNo
  26. you can tell it to skip that file when it loads it.
  27.  
  28. Remember, the cursor is placed at sFile when a file is loaded.
  29.  
  30. The learned sequence can move to another file because the command keeps track
  31. of the buffer number of the file that was loaded.  However, some things do not
  32. work right in Uedit when you do that so be careful.
  33.  
  34. buf57 = input dirpath
  35. buf55 = DOS LIST QUICK command
  36. buf42 = list of files
  37. n1    = buffer # of loaded file
  38. =============================================================================
  39.  
  40. Run current learned sequence on all files in directory
  41. <shftAltCtl-a:
  42.    equateNum(n99,1)
  43.    if (!askYesNo("Ask YesNo at critical points (or just run)?")) equateNum(n99,0)
  44.    putMsg("Input dirpath containing files:")
  45.    inputString(buf57)  ..show last one
  46.    freeBuf(buf55)
  47.    insertRgn(buf55,sFile,buf57,all)
  48.    insertRgn(buf55,sFile,"LIST ",all)
  49.    insertRgn(buf55,eFile," QUICK ",all)
  50.    freeBuf(buf42)
  51.    execute (buf42,buf55)
  52.    editBuf(buf42)
  53.    runKey(ctl-d) ..delete "Directory...." line
  54.    runKey(alt-2)  ..del trailing white
  55.    moveCursor(curFile,eFile)
  56.    runKey(normal-bs)  ..del EOL on last line
  57.    runKey(ctl-d) ..del #files, #blocks line
  58.    runKey(normal-bs)  ..del EOL on last line
  59.    moveCursor(curFile,sFile)
  60.    refreshDisplay
  61.    if (!askYesNo("Proceed with this file list?")) returnFalse
  62.    while (nothing) {
  63.       ..get a file name
  64.       editBuf(buf42)
  65.       if (is(curFile,eFile)) return
  66.       if (!is(curFile,sLine)) moveCursor(curFile,sLine)
  67.       equateLoc(buf42,sHilite,atCursor)
  68.       moveCursor(buf42,eLine)
  69.       equateLoc(buf42,eHilite,atCursor)
  70.       ..alertUser("got name of file")..debug
  71.       ..create pathname
  72.       freeBuf(buf55)
  73.       insertRgn(buf55,sFile,buf57,all)
  74.       if (!is(buf55,":")) insertChar(buf55,"/")
  75.       insertRgn(buf55,eFile,buf42,hilite)
  76.       loadFile(buf55)
  77.       equateNum(n1,curFile) ..record buf# to delete later
  78.       if (eqNum(n99,1)) {  ..show alerts
  79.             if (askYesNo("Run learned sequence with this curFile?"))
  80.             runKey(ctl-r) }                         ..run the learned sequence
  81.          else
  82.             runKey(ctl-r)
  83.       freeBuf(buf[n1])
  84.       if (!moveCursor(buf42,downLine)) returnTrue }                     ..exit
  85.    >Saturday 23-Feb-91 21:12:09
  86.