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

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • 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: 6826
  • Hero Points: 526
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: 6826
  • Hero Points: 526
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: 2620
  • Hero Points: 210
  • Text
Re: macro recording: grep_command_menu doesn't get recorded
« Reply #3 on: September 16, 2020, 06:01:43 PM »
Thanks!