How can I do a jump to a variable line number?

How can I do a jump to a variable line number?

1
NewbieNewbie
1

    Mar 10, 2006#1

    Hi,

    I have 2 files, one contains line numbers refering to the lines in the other file, e.g.,

    in file#1, the content is like:
    234 Transaction open.
    378 Transaction closed.
    ......

    the "234", "378" refer to the actual line numbers in file#2.

    How can I write a macro, when a user open file#1 and run a macro and the macro can fetch the line number and navigate to the specified line in file#2?

    Thanks in advance.

    Leon

    6,686585
    Grand MasterGrand Master
    6,686585

      Mar 10, 2006#2

      The UltraEdit macro language does not support variables. So you can't use GotoLine with a variable line number loaded from a different file. You can specify the line number on the command line of uedit32.exe when opening a file - see in help of UltraEdit the topic "Command Line Parameters". Maybe this will help you.

      If you want to solve your problem with a macro, you have to temporary edit file#2 to go to the line you want. Here is the macro which goes to the line which number (as string) is currently in the clipboard. You can develop the part to copy the line number from file#1 to clipboard by yourself.

      How it works:

      It inserts at every line with the insert number feature of the column mode the line number and a separator string. Then it goes to the line specified in the current clipboard, modifies the inserted separator string of this line, removes all line numbers and the separator string and goes again to the special marked line where it deletes the mark. Awful, but it works. You can use a different separator string than #!##! and a different special mark string than !#!!# if you don't like these strings or the could exist in your file#2.

      Don't forget to enable the macro property Continue if a Find with Replace not found.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Top
      ColumnModeOn
      SelectToBottom
      StartSelect
      Key HOME
      "#!##!"
      EndSelect
      Top
      ColumnInsertNum 1 1 LeadingZero
      ColumnModeOff
      Find "^c#!##!"
      IfFound
      "!#!!#"
      EndIf
      Top
      Find RegExp "%[0-9]+#!##!"
      Replace All ""
      Find "!#!!#"
      IfFound
      Delete
      EndIf
      UnixReOn

      Remove the last red command, if you use regular expression in UltraEdit style by default instead of Unix style.
      For UltraEdit v11.10c and lower see Advanced - Configuration - Find - Unix style Regular Expressions.
      For UltraEdit v11.20 and higher see Advanced - Configuration - Searching - Unix style Regular Expressions.
      Macro commands UnixReOn/UnixReOff modifies this setting.
      Best regards from an UC/UE/UES for Windows user from Austria