Shortcut for searching in specific paths for a text in specific file types

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
azzido
Junior Member
Junior Member
Posts: 2
Joined: 2020-01-10, 08:27 UTC

Shortcut for searching in specific paths for a text in specific file types

Post by *azzido »

Hello all,

Is there a way to customize command cm_SearchFor 501 with already prefilled paths in "Search in" field and prefilled file types in "Search for" field ?

I want to find for a text in files "*.c *.h *.asm" but in multiple directories like "d:\dir1\dir1_1 d:\dir2 d:\dir3_3_3".

I was thinking to customize cm_SearchFor and to specify file types and path directories as input.

Many thanks
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50873
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Shortcut for searching in specific paths for a text in specific file types

Post by *ghisler(Author) »

You can save search parameters via 4th tab of the search dialog, then use a button with:
LOADSEARCH name of saved search
Author of Total Commander
https://www.ghisler.com
User avatar
nsp
Power Member
Power Member
Posts: 1951
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Shortcut for searching in specific paths for a text in specific file types

Post by *nsp »

In your case, using loadsearch is flexible enough if:
- You fill search in parameter (if you read help do not mess up with > char as it is not mandatory at least in B12) !
- You can use also use temp file to search in folder list like @c:\temp\MyFolderList.txt and prepare project or workpace file .... even use with virtual panel or any script to prepare your temporary list.
User avatar
dindog
Senior Member
Senior Member
Posts: 316
Joined: 2010-10-18, 07:41 UTC

Re: Shortcut for searching in specific paths for a text in specific file types

Post by *dindog »

support++
I'm writing almost the same feature request thread.
allow saving a search setting leaving one or some parameters input when they were called.

it is a bit like the starting ? in command bottom.
for example, I have a search plugin call AGE, which is calculate the last modified time or the created time by now. with it, I can easily search files like the created time or last modified time is in last 10 days. which is really useful when come to a backup files.
but at the moment, the load search is fixed, which mean the 10 days in the above example is fixed too. it is much more flexible if allow param like
loadsearch foosearch 10
User avatar
nsp
Power Member
Power Member
Posts: 1951
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Shortcut for searching in specific paths for a text in specific file types

Post by *nsp »

dindog wrote: 2020-01-11, 01:50 UTC support++
I'm writing almost the same feature request thread.
allow saving a search setting leaving one or some parameters input when they were called.

it is a bit like the starting ? in command bottom.
for example, I have a search plugin call AGE, which is calculate the last modified time or the created time by now. with it, I can easily search files like the created time or last modified time is in last 10 days. which is really useful when come to a backup files.
but at the moment, the load search is fixed, which mean the 10 days in the above example is fixed too. it is much more flexible if allow param like
loadsearch foosearch 10
Hi Dindog,

This is not suggestion thread !

TC does not embed any scripting language and is sometime not as parametric as we need but

Today the way to achieve your need is to create an external script/pgm to do it !
This script will :
read %commander_ini%
remove any temporary search from the searches section
take a "foosearch/any parameter" search as template and duplicate it to a temporary search replacing parameters from the command line using a naming convention (%x or $x or whatever) ...
save %commander_ini%


You can use AskPraram to fill your script or %A in a em_command if you want to fill it from command bar !

You will also have to call TC to launch loadsearch with the temporary search. This can be done using a dedicated em_command and call externally or internally...
azzido
Junior Member
Junior Member
Posts: 2
Joined: 2020-01-10, 08:27 UTC

Re: Shortcut for searching in specific paths for a text in specific file types

Post by *azzido »

This option with LoadSearch is good but not perfect :) Is there a method to press a key or execute a button that load the saved search automatically ?
User avatar
petermad
Power Member
Power Member
Posts: 16118
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Shortcut for searching in specific paths for a text in specific file types

Post by *petermad »

azzido wrote: 2020-01-13, 06:39 UTC ...execute a button that load the saved search automatically ?
A button for starting the saved search Mysearch:

Code: Select all

TOTALCMD#BAR#DATA
LOADSEARCH Mysearch

wcmicons.dll,47
Start Search with Mysearch


-1
To make the button:
1. Mark the green text above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctri+C).
3. Right click on TC's buttonbar and choose "Paste".
License #524 (1994)
Danish Total Commander Translator
TC 11.55rc4 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1393a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply