External search with Agent Ransack & FileLocator (Pro)

Discuss and share scripts and script files...
highend
Posts: 13313
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

External search with Agent Ransack & FileLocator (Pro)

Post by highend »

Inspired by this thread: http://www.xyplorer.com/xyfc/viewtopic.php?f=3&t=11128

MASSIVE UPDATE

I've created a script that let's you use an external search engine (that is a bit more flexible in terms of boolean / boolean regex searches when it comes to the content of files).

Atm it works with Agent Ransack, File Locator and it's commercial version File Locator Pro.
File Locator Pro's boolean regex is really a powerhorse^^

Prerequisite:
- Current beta version of XY (with support for paper folders)!
- Be in the folder that'll be the base for your search
It's not a necessity but the corresponding field is prefilled with the current path...

To set the script up, run it once, quit it and then edit the corresponding .ini file "<same name as the script file.ini>"
(in the same folder as the script).

"SearchEngine=" is the minimum requirement! If you are using FileLocator Pro and want to use indexed searches,
you need "IndexPath=" as well...


A screenshot of the search dialog window (XY side):
screenshot.png
screenshot.png (9.15 KiB) Viewed 9464 times
Current version:
v2018.05.12 Build 10.08
External search_v2018.05.12 Build 10.08.xys
(26.95 KiB) Downloaded 398 times
Older versions:
v2018.03.04 Build 10.07
External search_v2018.03.04 Build 10.07.xys
(14.15 KiB) Downloaded 284 times
v2015.06.26 Build 10.06
ExternalSearch_v2015.06.26 Build 10.06.zip
(3.45 KiB) Downloaded 341 times
v2014.06.29 Build 20.31
ExternalSearch_2014.06.29 Build 20.31.zip
(3.22 KiB) Downloaded 355 times
v2014.06.29 Build 17.12
ExternalSearch_v2014.06.29 Build 17.12.zip
(3.24 KiB) Downloaded 283 times
v2014.03.07 Build 21.16
ExternalSearch_v2014.03.07 Build 21.16.xys
(11.84 KiB) Downloaded 425 times
v2014.03.05 Build 09.23
ExternalSearch.xys
(7.46 KiB) Downloaded 410 times
One of my scripts helped you out? Please donate via Paypal

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

Re: External search (atm Agent Ransack)

Post by highend »

Pushed a little fix...
@Changelog:
v2014.03.05 Build 09.23
• Changed: Better detection of local / remote paths -> necessary because the
search engine's output delivers additional line numbers for all
hits when content search is used
One of my scripts helped you out? Please donate via Paypal

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: External search (atm Agent Ransack)

Post by kotlmg »

can you please give the above code for filelocator pro, instead of agent ransack.

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

Re: External search (atm Agent Ransack)

Post by highend »

Apart from the additional features that are currently not supported in the html dialog it's just a simple change for the $agentRansackFolder & $agentRansackExe ...

I'll post a new version soon that makes it a bit clearer (and support the additional drop down fields for FileLocator Pro).
One of my scripts helped you out? Please donate via Paypal

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

Re: External search (atm Agent Ransack)

Post by highend »

New version:
v2014.03.07 Build 21.16
• Added: Support for FileLocator & FileLocator Pro
• Changed: Made it easier to select the external search engine by only
supplying the full path to the .exe file

Code: Select all

    // Use the full path to either Agent Ransack or FileLocator (Pro)!
    $searchEngine = "C:\Program Files\Mythicsoft\Agent Ransack\AgentRansack.exe";
The different drop-down fields for FileLocator Pro
(File name | Containing text | Look in) are now fully supported.
One of my scripts helped you out? Please donate via Paypal

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: External search with Agent Ransack & FileLocator (Pro)

Post by kotlmg »

sir,
i have modified the code to file locator pro as follows.

Code: Select all

    $searchEngine = "C:\Program Files\Mythicsoft\FileLocator Pro\FileLocatorPro.exe";
thanks a lot sir, your code is superb.

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

Re: External search with Agent Ransack & FileLocator (Pro)

Post by highend »

@Changelog:
v2014.06.29 Build 17.12
• Added: Paper folder support, now you can do something really useful^^
One of my scripts helped you out? Please donate via Paypal

Stef123

Re: External search with Agent Ransack & FileLocator (Pro)

Post by Stef123 »

When I run it, I get an error, telling me it cannot find this path
if (listfolder("<xydata>\Paper\$paperSubFolderName", "*.txt", 32) >= $paperFilesLimit) {

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

Re: External search with Agent Ransack & FileLocator (Pro)

Post by highend »

Replace

Code: Select all

    // Check if we have more than $paperFilesLimit files
    if (listfolder("<xydata>\Paper\$paperSubFolderName", "*.txt", 32) >= $paperFilesLimit) {
        msg "There are more than $paperFilesLimit search results stored...<br>Press OK to delete them now or<br>Cancel to exit this script", 1;
        delete 1, 0, "<xydata>\Paper\$paperSubFolderName\*.*";
    }
with

Code: Select all

    // Check if we have more than $paperFilesLimit files
    if (exists("<xydata>\Paper\$paperSubFolderName") == 2) {
        if (listfolder("<xydata>\Paper\$paperSubFolderName", "*.txt", 32) >= $paperFilesLimit) {
            msg "There are more than $paperFilesLimit search results stored...<br>Press OK to delete them now or<br>Cancel to exit this script", 1;
            delete 1, 0, "<xydata>\Paper\$paperSubFolderName\*.*";
        }
    }
Or download the fixed version.
One of my scripts helped you out? Please donate via Paypal

Stef123

Re: External search with Agent Ransack & FileLocator (Pro)

Post by Stef123 »

Thank you, highend
both - for providing this script and for fixing it - works like a charm now. :appl:

binocular222
Posts: 1416
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: External search with Agent Ransack & FileLocator (Pro)

Post by binocular222 »

there's a problem when input search term is in unicode.
Example: search term = "thất nghiệp"
$searchParams="-s -o "C:\Users\nnguyen11\AppData\Local\Temp\~search_AR.txt" -oe8 -ofb -fed -ceb -lee -c "th%E1%BA%A5t+nghi%E1%BB%87p" -d "D:\Doc\Law""
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

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

Re: External search with Agent Ransack & FileLocator (Pro)

Post by highend »

Even when I use quote(utf8decode(urldecode($fileName)))
instead of just the quote($fileName))

E.g. for the file name part, I don't get your original search term back.

Original: "thất nghiệp"
After utf8decode/urldecode: "thất nghi�?p"
One of my scripts helped you out? Please donate via Paypal

Walrez
Posts: 25
Joined: 05 May 2008 16:42

Re: External search with Agent Ransack & FileLocator (Pro)

Post by Walrez »

Hi, and thanks for the replies.

I installed Agent Ransack and the script.

When I search for something, I get a list (paper folder, I guess. Didn't try those yet), with the resulting files.
What should I do after that to visualize a file (and search inside it)?

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

Re: External search with Agent Ransack & FileLocator (Pro)

Post by highend »

When I search for something, I get a list (paper folder, I guess. Didn't try those yet), with the resulting files.
What should I do after that to visualize a file (and search inside it)?
Sorry, never saw this response. You can't use an external search engine for a paper folder view. You have to know what you're searching for before you actually process the search (and enter the terms in the containing text: field, too).

A small update (didn't touch the code for almost a year):
@Changelog:
v2015.06.26 Build 10.06
• Changed: Changed the help file's link to the name of the search engine
• Changed: Processing of the output is done via regex, not with a foreach loop
• Changed: utf8decode(urldecode(...)) added
Changed the help file's link to the name of the search engine:
This may be cosmetic but sometimes I'm unsure which external search I'm invoking so this gives me the needed hint xD
One of my scripts helped you out? Please donate via Paypal

xyplorerköln
Posts: 177
Joined: 01 Jan 2016 18:59

Re: External search with Agent Ransack & FileLocator (Pro)

Post by xyplorerköln »

When running the v2015.06.26 Build 10.06 version of ExternalSearch, I get the error:
The system cannot find the file specified. (C:\Users\system\AppData\Local\Temp\~search_AR.txt)
when the script executes line 102:
$content = readfile($outputFile);

Post Reply