Author Topic: macro recording: grep_command_menu doesn't get recorded  (Read 204 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2158
  • Hero Points: 191
  • Text
macro recording: grep_command_menu doesn't get recorded
« on: September 15, 2020, 10:03:10 pm »
or really, any commands in the grep buffer.

I'm trying to grab the most recent search results and paste them into a buffer.
activate_search() works, but grep_command_menu and select_all do not.
select_all selects all text in the edit buffer, not in search results.

So .... how to correctly call grep_command_menu and copy all the text from the search results?


Code: [Select]
_command search_to_buffer() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
    _macro('R',1);
    activate_search();
    grep_command_menu("a")
    select_all();

    workspace_new_file('0','','C:\src\',"Plain Text",'','','');
    paste();
    sort_buffer('AIU');
    execute("delete-search/^File /u",'a');
}

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5702
  • Hero Points: 457
Re: macro recording: grep_command_menu doesn't get recorded
« Reply #1 on: September 15, 2020, 10:42:07 pm »
The problem is activate_search doesn't activate the editor control on the Search Resuls form. It doesn't even activate the form. It sets focus.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5702
  • Hero Points: 457
Re: macro recording: grep_command_menu doesn't get recorded
« Reply #2 on: September 15, 2020, 10:49:35 pm »
I added a _get_active_grep_wid() function.

Then you can do something like this:
Code: [Select]
   int grep_wid = _get_active_grep_wid();
   if (!grep_wid) {
      return;
   }
   p_window_id=grep_wid;
   grep_command_menu('a');
   select_all();
   copy_to_clipboard();

jporkkahtc

  • Senior Community Member
  • Posts: 2158
  • Hero Points: 191
  • Text
Re: macro recording: grep_command_menu doesn't get recorded
« Reply #3 on: September 16, 2020, 06:01:43 pm »
Thanks!