Page 1 of 1

Quick Search from a script

Posted: 14 Jul 2022 21:47
by John_C
The scripting commands reference says that to use quick search from within a script, I can use something like

Code: Select all

text quicksearch("*.jpg");
But how I can perform _actual_ quick search from within a script? That is, the files should be listed in the file list, the same way as if you use quick search by pressing F3.

Re: Quick Search from a script

Posted: 14 Jul 2022 21:55
by highend
by using a quick search pattern and use goto to invoke it?

goto "?*.png";

Re: Quick Search from a script

Posted: 14 Jul 2022 22:31
by John_C
This works, thanks.

But what I really try to accomply is to make Find Files and Quick Search utilize the same tab that is used to show recently opened files.

To show recently opened files, I use the following script that consists of just 2 lines:

Code: Select all

  goto '<get list_recentlyopenedfiles> ? /silent=1';
  sortbylist <get list_recentlyopenedfiles>;
The problem here that if you make a search (Ctrl+F) or quick search (F3), search results will be opened in another tab. Not in the tab that was created by the script above.

So we need some hack, some workaround here. I have realized that if I create a new tab, make some "dummy" quick search there (by pressing F3), and then paste the script above in the address bar, this will make the next quick search to be shown in the same tab. So, this workaround works.

However, for some unknown reason, this doesn't work if you make quick search from within a script (instead of pressing the F3 key). First I tried

Code: Select all

  tab('new'. '?*');
  goto '<get list_recentlyopenedfiles> ? /silent=1';
  sortbylist <get list_recentlyopenedfiles>;
and then

Code: Select all

  tab('new');
  goto '?*';
  goto '<get list_recentlyopenedfiles> ? /silent=1';
  sortbylist <get list_recentlyopenedfiles>;

Neither version solves the described problem.

My search settings are as follows:

Code: Select all

Tools > Configuration > Find Files & Branch View >

- Show search results in = "Search Results" tab
- Show quick search results in current tab = False