Quick Search from a script

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
John_C
Posts: 336
Joined: 16 May 2018 20:04

Quick Search from a script

Post 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.

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Quick Search from a script

Post by highend »

by using a quick search pattern and use goto to invoke it?

goto "?*.png";
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: Quick Search from a script

Post 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

Post Reply