Author Topic: Macro recording problem  (Read 2532 times)

guth

  • Senior Community Member
  • Posts: 104
  • Hero Points: 7
Macro recording problem
« on: January 25, 2013, 06:26:17 PM »
Today when programming at work I wanted to do some refactoring. The task I wanted to do was copying constants and expressions from if statements into a data structure, like this

if BLA == 10:
    retval = an_class(BLA,
                              12,
                              13)

into

d = {BLA: an_object(BLA, 12, 13)}

Around 20 such copying, pasting, editing, a mundane task indeed, I thought I could do better by utilizing macro recording. I did this. I marked BLA with the mouse and copied it, marked an_object(BLA, 12, 13) and copied it. Moved the cursor to where the data structure should be located and started macro recording CTRL-X (
choose showing clipboards CTRL-Shift V
one step down and enter to paste BLA
type " : "
CTRL-Shift V and one step down and enter to paste an_object(BLA,
12,
13)
and then select join-lines two times, then stopping macro recording with CTRL-X )

Now I thought I hade a macro so that I "only" needed to copy two things and then place the cursor to quickly paste and reformat. It didn't work. It seems Slickedit cannot handle selecting from history of clipboard, and it cannot use join-lines in a macro. How would you have recorded this, if possible?

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: Macro recording problem
« Reply #1 on: January 25, 2013, 07:26:39 PM »
It did used to work, but looks like macro recording with the list clipboards tool window doesn't work as well as it should.  I will file a defect and see if it can be hotfixed or fixed for a future release. 

You could work around this by saving as new custom macro and replacing
Code: [Select]
list_clipboards(); lines in the recorded macro with:
Code: [Select]
goto_clipboard(N); paste(); where N is the clipboard item you selected, as listed in the Name column in the Clipboards tool window.  You then would need to reload the macro.