Page 1 of 1

Accessing find files information in scripts or viewer

Posted: 19 Apr 2011 15:29
by Miguel Melo
One thing I don't believe is available in xy is having access to the current find files settings when operating on a Search Results tab... am I correct?

One really cool thing that xplorer2 has that seems to be missing on xy yet is that you can do a file search (that produces results in what x2 calls a "scrap container") containing text (i.e. that searches also INSIDE the files) and, once you have the results, launching their viewer (which they call editor2) immediately passes into said viewer the string you have searched for last, and loads it into the "Find Next" so you can start pressing F3 and find the actual place(s) of the match right away.

I'd like to make two suggestions:

1) Add a XYplorer Native Variable that contains the "Contents" field in the search panel so that it can get passed to outside programs/used in scripts;

2) Optionally, for extra bonus points :D, extend the XYplorer Quick File Viewer (text mode) to support Find/Find next _and_ feed into this viewer the File contents variable;

What do you reckon, Don? :mrgreen:

Re: Accessing find files information in scripts or viewer

Posted: 28 Apr 2011 01:39
by Miguel Melo
Sorry for the shameless bump... :oops:

Don, do you see any virtue on my previous suggestions? At least bullet (1) should be pretty simple to implement (and would allow me to, say, call VIM with a command to immediately seek to the search text). ;)

Thanks!

Re: Accessing find files information in scripts or viewer

Posted: 28 Apr 2011 06:02
by avsfan
+1 from me -- having a find/find next would be VERY nice (particularly when viewing a file/files that have been found based on their content...)

Re: Accessing find files information in scripts or viewer

Posted: 02 May 2011 09:19
by admin
Miguel Melo wrote:Sorry for the shameless bump... :oops:

Don, do you see any virtue on my previous suggestions? At least bullet (1) should be pretty simple to implement (and would allow me to, say, call VIM with a command to immediately seek to the search text). ;)

Thanks!
Yes, not bad. I think I can do that ( bullet (1)). :)

Re: Accessing find files information in scripts or viewer

Posted: 02 May 2011 09:30
by admin
OK, in the next beta version you can use any of these:

Code: Select all

echo <get find_contents>;
echo get("find_contents");
Note that it will return the contents of the last search of the current pane in this session.

I have no time to document it now. Please just let me know how it works.

Re: Accessing find files information in scripts or viewer

Posted: 02 May 2011 14:57
by Miguel Melo
admin wrote: I have no time to document it now. Please just let me know how it works.
Just tried it - works fine! Many thanks Don! :D

For the benefit of other people here's how I used it: I added a new User "Open" command with the following item:

Code: Select all

"C:\Program Files (x86)\vim\vim73\gvim.exe" "<curitem>" -c "/<get find_contents>\c"
This launches VI and seeks to 1st occurrence of the (last) searched for "Contents". FYI, the "\c" at the end makes the search case insensitive.