- AuthorPosts
- May 29, 2022 at 8:37 am #28218spirosParticipant
I often want to copy multiple different bits of texts and then paste all of them in a different file. Ideally, I would like to be able to paste all the recent strings copied, separated by an adjustable delimiter, say the pipe (|).
For example, if I copied the bits above which were bold, I would like to be able to paste them in one go like this:
multiple different|paste all of them|file|recent strings copied|adjustable delimiter
Is something like this possible? Emeditor clipboard already contains the items, but there seems no way to manipulate them in the way described, ie. paste all of them (preferably with an adjustable delimiter).
Another way would be multiple selection, but again when pasting there is no way to control the delimiter (line break is the default).
May 29, 2022 at 11:01 am #28219Yutaka EmuraKeymasterYou can write a macro to do this:
sDelimiter = "|"; // delimiter to separate clipboard items menu = CreatePopupMenu(); i = 0; do { str = clipboardData.getData("text", i); if( str.length == 0 ) break; str = str.substr( 0, 40 ) menu.Add( str, i + 100 ); i++; } while( 1 ); result = menu.Track( 0 ); if( result != 0 ) { iMax = result - 100; str = ""; for( i = 0; i <= iMax; ++i ) { if( str.length != 0 ) { str += sDelimiter; } str += clipboardData.getData("text", i); } document.write( str ); }
Please see getData Method of ClipboardData:
http://www.emeditor.org/en/macro_clipboarddata_getdata.htmlMay 30, 2022 at 1:32 am #28220spirosParticipantWow, interesting!
I copied multiple items, then ran the macro, but it just displayed a pop-up with each item separated by line break.
Maybe it would be easier to have a delimiter setting for the paste of multiple selection items? I can imagine many people could find that useful since they could use the delimiter of their choice to match their situation.May 30, 2022 at 1:44 am #28221spirosParticipantAlso, the paste options box (Show clipboard History on Paste), could also have the options “Paste all” (with associated hotkey), “Delete all” and in “Customize” an option could be added so that the user can set the delimiter for “Paste all”. Currently, it only has “Select all” which can be useful only if one wants to delete all (requiring 2 steps to delete).
May 30, 2022 at 6:19 pm #28226Yutaka EmuraKeymasterAs for the delimiter in the macro, you can change the delimiter at the first line of the macro.
May 30, 2022 at 11:50 pm #28229spirosParticipantYes, understood. But running the macro does not paste the text. It only produces the pop-up in the image.
May 31, 2022 at 8:19 am #28230Yutaka EmuraKeymasterDid you select any item in the menu to paste the selected item and all above items?
May 31, 2022 at 9:18 am #28231spirosParticipantAh, sorry, I did not understand how they would be entered. Yes, they are entered when selected!
I found an easier way though to automate. Use multiple selection, copy, paste, select pasted text and run a macro that replaces commas and line breaks with pipe.
I was not sure how to trim spaces left and right of pipe so I added some extra lines for that. I was not sure either if a macro could paste directly like this after multiple selection and copy (I tried using your macro with paste after multiple copy, but it did not add the delimiter.).document.selection.Replace(", ","|",eeFindReplaceSelOnly | eeReplaceAll,0); document.selection.Replace(" |","|",eeFindReplaceSelOnly | eeReplaceAll,0); document.selection.Replace("| ","|",eeFindReplaceSelOnly | eeReplaceAll,0); document.selection.Replace("\\n","|",eeReplaceSelOnly | eeReplaceAll | eeFindReplaceRegExp,0);
- AuthorPosts
- You must be logged in to reply to this topic.