Tapatalk

Replace each number with number+5

Replace each number with number+5

2
NewbieNewbie
2

    Aug 19, 2006#1

    hello!

    I'm try to find a way to replace some numbers in .xml files!

    Example: <Location top="5563" left="1192" bottom="5685" right="1244"/>

    replace to: <Location top="5563" left="1192" bottom="5690" right="1249"/>


    how to do it? thanks!

    6,685587
    Grand MasterGrand Master
    6,685587

      Aug 19, 2006#2

      You need 2 macros for this job. The first one which you must create first is my universal submacro CountUp which is posted at counter ?

      After you have created the submacro CountUp, create the main macro for your individual usage which needs the macro property Continue if a Find with Replace not found enabled.

      The code for the main macro is:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Clipboard 7
      Top
      Loop
      Find RegExp "bottom="[0-9]+""
      IfNotFound
      ExitLoop
      EndIf
      EndSelect
      Key LEFT ARROW
      StartSelect
      Key LEFT ARROW
      Key LEFT ARROW
      Key LEFT ARROW
      Key LEFT ARROW
      Copy
      PlayMacro 1 "CountUp"
      SelectWord
      PlayMacro 1 "CountUp"
      SelectWord
      PlayMacro 1 "CountUp"
      SelectWord
      PlayMacro 1 "CountUp"
      SelectWord
      PlayMacro 1 "CountUp"
      EndLoop
      Top
      Loop
      Find RegExp "right="[0-9]+""
      IfNotFound
      ExitLoop
      EndIf
      EndSelect
      Key LEFT ARROW
      SelectWord
      Copy
      PlayMacro 1 "CountUp"
      SelectWord
      PlayMacro 1 "CountUp"
      SelectWord
      PlayMacro 1 "CountUp"
      SelectWord
      PlayMacro 1 "CountUp"
      SelectWord
      PlayMacro 1 "CountUp"
      EndLoop
      Top
      ClearClipboard
      Clipboard 0

      Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.

      Edited macro on 2006-08-20:

      Replaced

      StartSelect
      Key LEFT ARROW
      Key LEFT ARROW
      Key LEFT ARROW
      Key LEFT ARROW

      with the single command SelectWord because the macro should work for all numbers not only for numbers with 4 digits.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Aug 20, 2006#3

        thanks a lot! I try it now...