Run Macro for each Find in Files Hit

Run Macro for each Find in Files Hit

2

    Mar 23, 2005#1

    I would like to use a combination of the Find in Files and Set Macro for File Load/Save behaviors. I have many many template files (not UltraEdit templates) that need a parameter changed. I would like to use Find In Files to identify all the files that require updating. Then the Macro Name to Execute on Load would issue the appropriate find and replace commands to identify/change the parameter and close the file.

    Is such behavior already available? It appears to me that the Find In Files does not issue a Load event that would trigger the macro to execute.

    I really could use a sophisticated Change En Masse behavior.

    261
    Basic UserBasic User
    261

      Mar 24, 2005#2

      Have you tried Search | Replace in Files? It sounds like it might do the trick without using a macro. (I added it to my toolbar it was so helpful.)

      Dave
      ASTTMan
      I'm not a Texan, I just live here.

      2

        Mar 24, 2005#3

        Replace in files is what I am doing. Unfortunately, what I want to replace occurs multiple times within a files. The files are configured with blocks of parameters, each beginning with BEGIN <text> and END. I first have to locate the correct block before I can do a change of the parameters within that block. That is why I require the macro.

        What I do is "Find In File" to locate files with the desired BEGIN block (in bold, below). I thought that the opending of the file would trigger the macro to run, which would then relocate that BEGIN block, then find the END, then find the correct subparameter between the two (in red, below.)

        Without that Execute macro on Open trigger, I am basically hosed. With it, however, the doors are open for huge change behaviors.

        Thanks,
        dvn

        BEGIN Report: Summary Listing
        + Create Files Per Segment (Y/N)..... = Y
        END
        BEGIN Report: Processing Center Listing (PER/STD/PSVC)
        + Create Files Per Segment (Y/N)..... = Y
        END
        BEGIN Report: IDEA Mail.dat
        (snip)
        + Create Files Per Segment (Y/N)..... = Y
        (/snip)
        END

        6,684586
        Grand MasterGrand Master
        6,684586

          Mar 25, 2005#4

          Run your Find in Files and write the result to an edit window. Use search and replace to remove everything except the file names with their path. Run a sort with deleting duplicates. Make sure, the list file ends with a line break and only contains lines with file names. Save the list file. Now you have a sorted list of files, which must be modified by the macro.

          Now run this macro on the list file:

          InsertMode
          ColumnModeOff
          HexOff
          UnixReOff
          Top
          Loop
          StartSelect
          Key END
          Copy
          Open "^c"
          PlayMacro 1 "case-sensitive name of your macro"
          Save
          CloseFile
          EndSelect
          Key RIGHT ARROW
          IfEof
          ExitLoop
          EndIf
          EndLoop

          You can create the list file also with a macro. Simply record during creating in the first time.
          Best regards from an UC/UE/UES for Windows user from Austria