Copy to clipboard bookmarked lines?

Copy to clipboard bookmarked lines?

2
NewbieNewbie
2

    Jan 13, 2006#1

    Hi,
    I would like to know if there's a way in UltraEdit 11.20 to copy to clipboard all the bookmarked lines of the file?
    Thanks in advance!

    6,675585
    Grand MasterGrand Master
    6,675585

      Jan 13, 2006#2

      This macro will do it. The "ÿ" is a character with hex code 0x255 and is used to mark first bookmark to avoid an endless loop. You can use any other character which is surely not present at start of a line in your file. I have also added some extra codes to avoid also an endless loop if no bookmark is present in the current file. With no bookmarks set only the current line is copied to the clipboard. The file must be temporarily modified with the "ÿ", so you can't use the macro on a read-only file.

      InsertMode
      ColumnModeOff
      HexOff
      Top
      GotoBookMark
      SelectLine
      Copy
      EndSelect
      Key UP ARROW

      Key HOME
      IfColNumGt 1
      Key HOME
      EndIf

      "ÿ"
      Key LEFT ARROW
      Loop
      GotoBookMark

      Key HOME
      IfColNumGt 1
      Key HOME
      EndIf

      IfCharIs "ÿ"
      Key DEL
      ExitLoop
      Else
      SelectLine
      CopyAppend
      EndIf
      EndLoop


      Edited on 2006-08-25: The macro works now also when the configuration option Editor - Miscellaneous - Home Key Always Goto Column 1 is not checked and the configuration option Editor - Bookmarks - Bookmark column with line is checked. The second feature is available since UEStudio 6.00 and will be available for UltraEdit with next release v12.20 (current version is v12.10a).

      Edited on 2011-03-26: For a script solution not modifying active file and therefore working also on a read-only file see Copying all bookmarked lines to active clipboard.

      PS: With UltraEdit v12.20a+2 and UEStudio v6.10a+2 or any later the 2 command sequences

      Key HOME
      IfColNumGt 1
      Key HOME
      EndIf


      could be replaced by single command

      GotoLine 0 1

      to make the macro faster which moves the caret also always to start of active line.

      2
      NewbieNewbie
      2

        Jan 13, 2006#3

        Hi Mofi,
        thank you very much for your answer!
        I've tried your suggested macro and it works great!
        It's a very useful functionality to analyze log files.
        Thanks again for your help! :)

        2
        NewbieNewbie
        2

          Jan 17, 2014#4

          Hi Mofi,

          Do you have Mac version of this macro?

          I am trying to use this Macro with Mac book. But it complains about TOP and HOME keywords. Are there any alternative commands I can use with Mac implementation?

          Thanks,
          Sherin.

          6,675585
          Grand MasterGrand Master
          6,675585

            Jan 17, 2014#5

            I do not have a Mac and therefore have used never Mac version of UltraEdit.

            I'm surprised that UEM does not have command Top to move the caret to top of the file. I suggest to start recording a macro, press the key combination which moves caret to top of the file, stop macro recording, open the macro editor and look which command was recorded for moving the caret to top of the file. Use this command instead of Top.

            A replacement for command Key Home and the next 3 commands was posted already by me above. So there should be no problem to replace the 2 occurrences of the 4 lines containing command Key Home by GotoLine 0 1 in the macro to move caret to first column in current line. You could also simply record the execution of the key combination moving caret to beginning of a line.

            According to OS X keyboard shortcuts the keys Command-Up Arrow need to be pressed to move caret to beginning of the file and the keys Command-Left Arrow to move the caret to beginning of the current line.

            Nowadays I would nevertheless suggest to use the script solution instead of this macro solution as it does not modify the file temporarily resulting in adding 2 steps to undo chain.
            Best regards from an UC/UE/UES for Windows user from Austria

            2
            NewbieNewbie
            2

              Jan 17, 2014#6

              Thanks much, Mofi for your time and suggestion. I will give your steps a try. Thanks again!