Find/Replace with counting function question...

Find/Replace with counting function question...

2

    Jul 10, 2007#1

    Hello!

    I have a file where I will be doing a find/replace, but I want to replace with values that increment. Is this possible to do so in a UE Macro?

    Scenario is as follows...

    Searching for \0\ and starting with 0, replacing with \X\. After 100 replaces, change X to 1. After another 100, change X to 2 and so on until the end of the file is reached.

    I've combed through these forums, but haven't found much. Any ideas?

    :idea:

    6,681583
    Grand MasterGrand Master
    6,681583

      Re: Find/Replace with counting fucntion question...

      Jul 11, 2007#2

      Sure, this is possible. First you have to create my universal CountUp macro posted at counter ? and also packed into the zip-archive ready for usage at Macro examples and reference for beginners and experts.

      Then you have to create an additional macro which does the 100 replaces in a loop and has following content:

      Loop 100
      Find "\0\"
      Replace "\^c\"
      IfNotFound
      ExitLoop
      EndIf
      EndLoop

      Name this macro for example Replace100.

      And last you have to create the main macro which calls this 2 submacros.

      The macro property Continue if a Find with Replace not found must be checked for all these macros.

      InsertMode
      ColumnModeOff
      HexOff
      Top
      "0"
      Clipboard 9
      StartSelect
      Key LEFT ARROW
      Cut
      EndSelect
      Loop
      PlayMacro 1 "Replace100"
      Find "\0\"
      IfNotFound
      ExitLoop
      EndIf
      Key HOME
      IfColNumGt 1
      Key HOME
      EndIf
      PlayMacro 1 "CountUp"
      EndLoop
      Top
      ClearClipboard
      Clipboard 0

      Note: I have written the macros directly in the edit field in the browser window and so I have not tested it.
      Best regards from an UC/UE/UES for Windows user from Austria

      2

        Jul 11, 2007#3

        Mofi,

        Thank you thank you thank you!

        I read over your CountUp macro but didn't have enough understanding about UE's Macro language to do the whole "call 2 macros from a macro" step.

        Cheers from the USA!