Author Topic: Recorded Macro Bug???  (Read 3261 times)

Dswag89

  • Community Member
  • Posts: 63
  • Hero Points: 4
Recorded Macro Bug???
« on: October 27, 2006, 08:30:04 pm »
I'm not a huge macro user, but I sporadically record "one-time" macros to clean up a set of data to be saved off.  I've noticed some problems with SlickEdit 11 (currently using 11.0.2) and am wondering if this is a bug or a purposeful modification to how macros work.  First off, here's the "dirty text".

Code: [Select]
vector_error_17(  void )

6 0 11 0.545 ------
vector_error_1a(  void )

6 0 11 0.545 ------
vector_error_1d(  void )

6 0 11 0.545 ------
white_space(  U_8 )

To set up my macro, I first perform a "CTRL+F" and search for '('.  That places the cursor on (and highlights) the open-paren after vector_error_17.  Then, I type:
CTRL+F11 (turns Macro Recording On)
SHIFT+END (highlight to end of line)
DELETE (Delete everything after the end of the open-paren)
CTRL+G (go to next open-paren)
CTRL+F12 (turns Macro Recording Off)

I saved this macro as "no_works" because when I run it, it successfully finds each "next" open-paren, but it does not delete the stuff from the current open-paren to the end of the line (like it did when I initially recorded it).

To get this macro to work, I had to do something slightly different.
Starting at the same point (cursor on and highlighting the open-paren after vector_error_17), I type:
CTRL+F11 (turns Macro Recording On)
LEFT ARROW (to get rid of selection)
RIGHT ARROW (to get back beside open paren)
SHIFT+END (highlight to end of line)
DELETE (Delete everything after the end of the open-paren)
CTRL+G (go to next open-paren)
CTRL+F12 (turns Macro Recording Off)
I saved this macro as "works" because it does exactly what I wanted.  My question is, why do I have to do the left-arrow + right-arrow thing to deselect before doing the rest of my macro?  I know I didn't have to do this back with SE6.

Thanks for any help/guidance!

For further info, here's the Slick-C code for both of the macros:
Code: [Select]
_command works() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   _macro('R',1);
   _deselect();
   cursor_left();
   cursor_right();
   deselect();
   _select_char('','E');
   end_line();
   select_it('CHAR','','E');
   delete_selection();
   find_next();
}
_command no_works() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   _macro('R',1);
   end_line();
   select_it('CHAR','','E');
   delete_selection();
   find_next();
}

Zak

  • Community Member
  • Posts: 5
  • Hero Points: 0
Re: Recorded Macro Bug???
« Reply #1 on: October 30, 2006, 12:43:21 pm »
In order to delete a character selection block, you need to set up both a starting and an ending point to define the block.  In your sample code (no_works), I only see one call to select_it()... after you move to the end of line.  Put in another call to select_it() before moving to the end of line and it will work:

_command no_works() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL)
{
   _macro('R',1);
   select_it('CHAR','','E'); // start block
   end_line();
   select_it('CHAR','','E'); // end block
   delete_selection();
   find_next();
}

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: Recorded Macro Bug???
« Reply #2 on: October 30, 2006, 01:00:22 pm »
Or use delete-end-line in this use case.
Maybe there is an issue w/ hiliting and really selecting ...
In general it's seems more 'save' to explicitely set start and end of a selection in the desired mode.
Or to specify more sophisticated regexps (and use replace) ;)

HS2

Dswag89

  • Community Member
  • Posts: 63
  • Hero Points: 4
Re: Recorded Macro Bug???
« Reply #3 on: October 30, 2006, 02:22:20 pm »
Thanks for the thoughts, but like I've said in the past... I'm really not a power-user.  I just hack-through these types of edits and then throw away the macros.  The "no-works" key sequences work in SE6 but don't work now... so I think something has changed.  As for using more sophisticated reg-exs, it would take me 5 times as long to figure out the regular expression to setup as it did to figure out the work-around.  I really don't use them often enough to have them in my head.  I don't really think it is worth reporting as a bug to "Support", but I know that the developers watch this forum quite closely and if one of them picks it up, we'll see where it leads...


hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: Recorded Macro Bug???
« Reply #4 on: October 30, 2006, 02:33:09 pm »
Quote
...take me 5 times as long to figure out the regular expression...
Me too - that's the reason for the ;) ...

HS2