Fill columns with copied text

Fill columns with copied text

27
Basic UserBasic User
27

    Jun 04, 2013#1

    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.

    6,602548
    Grand MasterGrand Master
    6,602548

      Jun 04, 2013#2

      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();
            if (typeof(UltraEdit.columnModeOn) == "function") UltraEdit.columnModeOn();
            else if (typeof(UltraEdit.activeDocument.columnModeOn) == "function") UltraEdit.activeDocument.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.

      27
      Basic UserBasic User
      27

        Jun 05, 2013#3

        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.