Re-select pasted text?

Re-select pasted text?

6
NewbieNewbie
6

    Nov 09, 2006#1

    Hi,

    I'd like to create a macro to move a selected text with the keyboard. Therefore in my macro, I would cut a selected text, move the cursor one step in the desired direction and then paste the text. Ok so far.
    But to do this repeatedly, the macro must re-select the pasted text. How could I do that? I think it is not possible to count the number of characters in the clipboard or of the selection?

    TIA,
    Rob

    344
    MasterMaster
    344

      Nov 09, 2006#2

      Hi Rob,

      reselection and undo are not possible via macro.
      But why don't you just use cut & paste as normal ?
      Where is the benefit ?

      Well, for a SINGLE line, it IS possible.
      Best, bind those 2 move-macros to shift-ctrl-ArrowUp / shift-ctrl-ArrowDown :-)

      rds Bego

      Makro setDefaults (use YOUR favorite default settings for it...)

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOn
      Clipboard 0
      

      Makro MoveLineUp:

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      IfSel
      Else
      Clipboard 9
      SelectLine 
      Cut 
      Key DOWN ARROW
      Paste 
      Key UP ARROW
      EndIf
      PlayMacro 1 "setDefaults"
      

      Makro MoveLineDown:

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      IfSel
      Else
      Clipboard 9
      SelectLine 
      Cut 
      Key DOWN ARROW
      Paste 
      Key UP ARROW
      EndIf
      PlayMacro 1 "setDefaults"
      
      Normally using all newest english version incl. each hotfix. Win 10 64 bit

      6,608550
      Grand MasterGrand Master
      6,608550

        Nov 09, 2006#3

        Why do you want to select the pasted text again?

        The text is still in the clipboard after paste and can be pasted as often as you want without selecting it again.

        However, you can select it again by search for the clipboard content:

        Find Up "^c"

        This works for clipboard content with a maximum of 30,000 characters (since v9.20).
        Best regards from an UC/UE/UES for Windows user from Austria

        344
        MasterMaster
        344

          Nov 09, 2006#4

          Tag Mofi,

          I THINK he wants to "VISUALLY move" some lines up or down.
          Normally using all newest english version incl. each hotfix. Win 10 64 bit

          6
          NewbieNewbie
          6

            Nov 10, 2006#5

            Hi Bego, hi Mofi!

            Yep, Bego, you're right, I want to visually move text lines. Since I discovered this feature in Eclipse, I'm eager to have it in UE also. The next logical step was of course to be able to move portions of text to the left and right also.
            BIG thanks Mofi for that great tip using "Find" - it does a great job!
            Bego, thanks for your scripts! I had done the same in the beginning, then I've found the "SelectLine" command, making things a bit easier. A great idea is to have a macro with default settings to restore them after a macro - I will incorporate that in all future macros.

            These are my VisualMove (tm) macros right now:

            Move sel left

            Code: Select all

            Clipboard 8
            InsertMode
            ColumnModeOff
            Cut 
            Key LEFT ARROW
            Paste 
            Find Up "^c"
            Clipboard 0
            Move sel right

            Code: Select all

            Clipboard 8
            InsertMode
            ColumnModeOff
            Cut 
            Key RIGHT ARROW
            Paste 
            Find Up "^c"
            Clipboard 0
            Move line down

            Code: Select all

            Clipboard 8
            InsertMode
            ColumnModeOff
            SelectLine 
            Cut 
            Key DOWN ARROW
            Paste 
            Key UP ARROW
            Clipboard 0
            Move line up

            Code: Select all

            Clipboard 8
            InsertMode
            ColumnModeOff
            SelectLine 
            Cut 
            Key UP ARROW
            Paste 
            Key UP ARROW
            Clipboard 0
            Copy line down

            Code: Select all

            DupeLine
            Copy line up

            Code: Select all

            DupeLine
            Key UP ARROW