Copy to clipboard bookmarked lines?

Help with writing and playing macros

Copy to clipboard bookmarked lines?

Postby bambam27 » Thu Jan 12, 2006 11:15 pm

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!
User avatar
bambam27
Newbie
 
Posts: 2
Joined: Thu Jan 12, 2006 12:00 am

Re: Copy to clipboard bookmarked lines?

Postby Mofi » Fri Jan 13, 2006 7:55 am

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 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.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4066
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Copy to clipboard bookmarked lines?

Postby bambam27 » Fri Jan 13, 2006 3:58 pm

Hi Bego and Mofi,
Thank you very much for your answers!
I've tried Mofi's suggested macro and it works great!
It's a very useful functionality to analyze log files.
Thanks again for your help! :)
User avatar
bambam27
Newbie
 
Posts: 2
Joined: Thu Jan 12, 2006 12:00 am


Return to Macros