Can "Find Files..." area be persistent with Ctrl+F ?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kkonstantinidis
Posts: 20
Joined: 15 Jan 2020 01:45

Can "Find Files..." area be persistent with Ctrl+F ?

Post by kkonstantinidis »

Hi, I am a new user of XYplorer and I could not find an answer to this after a quick search.

Imagine the following scenario. I want to search for a file so I use the Ctrl + F shortcut or Edit -> Find Files.... Assume that I haven't clicked anywhere else on XYplorer after the search and I want to perform another search. If I press Ctrl + F again, I would expect XYplorer to activate the search area (it should be already active in this case) and highlight the search text so that I can type in my new query. Instead, if the search area is active, XYplorer hides it and I need to press Ctrl + F again, a non-desired behavior for me judging by other programs such as Notepad++, Chrome, PyCharm, etc. (just to give some examples). I find this behavior frustrating especially if I need to search for a few files and need to pay attention to whether the search area is active or not to decide if I need to press Ctrl+F again.

Is there any setting or even workaround to achieve this in XYplorer?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Can "Find Files..." area be persistent with Ctrl+F ?

Post by highend »

Then bind "Ctrl + F" to "Miscellaneous / Find Files / Open Find Files and Reset"
and e.g. "Ctrl + Shift + F" to "Edit / Find Files..."
One of my scripts helped you out? Please donate via Paypal

kkonstantinidis
Posts: 20
Joined: 15 Jan 2020 01:45

Re: Can "Find Files..." area be persistent with Ctrl+F ?

Post by kkonstantinidis »

It seems to work. However, this deletes the previous query, it's not just selecting it/moving the cursor on it. Many times I just need to search for something slightly different. I was surprised that they made it is so counter-intuitive. Is there any other option? Thanks for the suggestion though.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Can "Find Files..." area be persistent with Ctrl+F ?

Post by highend »

Use AutoHotkey?

Create an AHK script and compile it!

Code: Select all

#NoEnv
#SingleInstance force

; Command line arguments
if (A_Args.Length() != 1) {
    ExitApp
}

findStr := A_Args[1]
;OutputDebug, % "findStr: " findStr

Sleep, 100
SendInput {Raw}%findStr%
SendInput ^a
ExitApp
Let's say you've saved it as SendFindStringToXY.ahk and you've compiled it to SendFindStringToXY.exe


Create an UDC in XYplorer and use this script for it (adapt the path in it!):

Code: Select all

    $tmpIni = "%TEMP%\~XYplorer.ini";
    savesettings 1, $tmpIni;

    $findStr = getkey("Named0", "Named", $tmpIni);
    delete 0, 0, $tmpIni;
    run """<path to>\SendFindStringToXY.exe"" ""$findStr""";
    #1026;
Then unbind the Ctrl+F hotkey and bind it to this UDC.

XY will save a .tmp ini file, get the last used search keyword(s) from it, delete it.
Then it calls the compiled .ahk script with that search keyword(s) and that one
will just wait for a split second and then sends it to the search field in XYplorer
and sends Ctrl+A afterwards...

Yeah, I'm totally aware that XY supports the sendkeys command as well but in this
case I doesn't work (for me) reliable, hence the .ahk script...
One of my scripts helped you out? Please donate via Paypal

kkonstantinidis
Posts: 20
Joined: 15 Jan 2020 01:45

Re: Can "Find Files..." area be persistent with Ctrl+F ?

Post by kkonstantinidis »

This AHK script does not work on my end. I checked ~XYplorer.ini (without deleting it) and it seems to be getting the query correctly at Named0="...". However, an empty string seems to be sent to AHK's executable file so that file terminates immediately. Again, if I comment the if statement that terminates the AHK script and add

Code: Select all

MsgBox, % "findStr: " findStr
just to check, it displays no string on the message box. So when this is sent back to XYplorer field it deletes the previous query just like the "Miscellaneous / Find Files / Open Find Files and Reset" option.

It would help me if you specify the AutoHotkey version you are using. I have observed some inconsistencies among different versions in the past.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Can "Find Files..." area be persistent with Ctrl+F ?

Post by highend »

Add echo $findStr; after the delete 0, 0, $tmpIni; line
and then run a search.

Afterwards execute the script and show me:

01. The echo output box from XY
02. Your full XY script
One of my scripts helped you out? Please donate via Paypal

kkonstantinidis
Posts: 20
Joined: 15 Jan 2020 01:45

Re: Can "Find Files..." area be persistent with Ctrl+F ?

Post by kkonstantinidis »

After adding

Code: Select all

echo $findStr;
and search, the box indeed displays the current query of the search box, see http://imgur.com/a/S4ud5lJ

This is the entire script, the issue pesists:

Code: Select all

    $tmpIni = "%TEMP%\~XYplorer.ini";
    savesettings 1, $tmpIni;

    $findStr = getkey("Named0", "Named", $tmpIni);
    delete 0, 0, $tmpIni;
    echo $findStr;
    run """C:\Users\Kostas\SendFindStringToXYplorer.exe"" ""$findStr""";
    #1026;

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Can "Find Files..." area be persistent with Ctrl+F ?

Post by highend »

Add this line after#SingleInstance force
Msgbox, % "Number of arguments: " A_Args.Length() " | First: " A_Args[1]

- Recompile it
- Open a command prompt, cd into the folder that contains the recompiled .exe
- Execute SendFindStringToXYplorer.exe "hello world"
- Post a screenshot of the command prompt window and of the ahk msgbox...
One of my scripts helped you out? Please donate via Paypal

kkonstantinidis
Posts: 20
Joined: 15 Jan 2020 01:45

Re: Can "Find Files..." area be persistent with Ctrl+F ?

Post by kkonstantinidis »

I tried that and it shows empty strings on the message box for A_Args.Length() and A_Args[1]. I think these keywords were introduced in Autohotkey 2. I am still using 1.1.22.07. Hence, I made the following changes and this script seems to be working.

Code: Select all

#NoEnv
#SingleInstance force

; Command line arguments
; Debug
;MsgBox, %0%
noArgs = %0%
if (noArgs != 1) {
    ExitApp
}

; Debug
;MsgBox, %1%

;Sleep, 100
query = %1%
; Remove extra space added at the beginning
queryCleard = SubStr(query, 1)
SendInput, %query%
SendInput ^a
ExitApp
Thanks for your help. Again, I don't think we should have to do all this for something that just works (it has some delay). Is there any way I could submit this as a suggestion to the developers?

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: Can "Find Files..." area be persistent with Ctrl+F ?

Post by highend »

We have a "Wishes" section: viewforum.php?f=5
One of my scripts helped you out? Please donate via Paypal

Post Reply