Fill columns with copied text

Help with writing and playing macros

Fill columns with copied text

Postby wimille » Tue Jun 04, 2013 1:57 am

Hi,

I want to create a simple macro to use in a faster way the command "fill columns". The goal of this macro is to insert the copied text in the selected column.
For now, i wrote this :

Code: Select all
InsertMode
ColumnModeOn
HexOff
ColumnInsert "^c"


Then i select the text i want to paste in my columns, i select my columns and i launch the macro.
But, the columns are filled with "^c" instead of my original copied text.

I'm sure i'm miss something but i cannot see what?

Thanks for your help.
wimille
Newbie
 
Posts: 9
Joined: Sun Oct 02, 2011 5:56 am

Re: Fill columns with copied text

Postby Mofi » Tue Jun 04, 2013 7:14 am

Yes, you miss the fact that ^c is supported only by the commands Find, Replace, FindInFiles and ReplInFiles in search or replace string and the commands Open and SaveAs in file name string. All other commands do not support ^c.

You need an UltraEdit script for this task:

Code: Select all
if (UltraEdit.document.length > 0)
{
   // This condition could be removed if it should be possible to insert
   // the string in clipboard from current position to end of file.
   if (UltraEdit.activeDocument.isSel())
   {
      UltraEdit.insertMode();
      UltraEdit.columnModeOn();
      UltraEdit.activeDocument.columnInsert(UltraEdit.clipboardContent);
   }
}


Do you know that you can assign a hotkey to command ColumnInsertFill to

  • copy the selected text with Ctrl+C to clipboard,
  • switch to column editing mode with Alt+C if not already enabled,
  • select the columns to overwrite with the copied text,
  • press the hotkey of the command ColumnInsertFill,
  • press Ctrl+V to insert the copied text,
  • hit key Return to execute the command.
And for inserting short texts it is often easier to select the columns to overwrite in column editing mode, hit key Del to delete current text in the selected columns and simply type the short text to insert in the selected lines while still in column editing mode.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4049
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Fill columns with copied text

Postby wimille » Wed Jun 05, 2013 1:31 am

Thanks for all your explanations Mofi.
It was very useful.

As you say, i can use a hotkey to command ColumnInsertFill and use the method you give. But, my point is to use this method in a quicker way when i write my code. Then, your script is very good to do this.
wimille
Newbie
 
Posts: 9
Joined: Sun Oct 02, 2011 5:56 am


Return to Macros

cron