script to execute specific search
-
luckman212
- Posts: 9
- Joined: 09 Jul 2008 16:58
script to execute specific search
hello,
i want to use XY to store and later execute various special searches that I have designed (for example, searching specific folders for files that have their "index" bit not set). I have figured out that you can use the Search Templates feature to store and recall searches but I would like to be able to make Desktop shortcuts to directly launch XY and run these searches via scripting.
is this possible?? please can someone offer some guidance. thank you.
i want to use XY to store and later execute various special searches that I have designed (for example, searching specific folders for files that have their "index" bit not set). I have figured out that you can use the Search Templates feature to store and recall searches but I would like to be able to make Desktop shortcuts to directly launch XY and run these searches via scripting.
is this possible?? please can someone offer some guidance. thank you.
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Hi and Welcome to XYplorer,
Some basic searches can be done from catalog. Standard, Boolean and RegExp are suported. So you can store your search patterns in catalog for the time being. More advanced features like size, date, exclude folder are not possible from catalog. I too am hoping those things will be part of scripting soon.
Read Wiki about "Running a search from catalog":
http://88.191.26.34/XYwiki/index.php/Ca ... ame_Search
Some basic searches can be done from catalog. Standard, Boolean and RegExp are suported. So you can store your search patterns in catalog for the time being. More advanced features like size, date, exclude folder are not possible from catalog. I too am hoping those things will be part of scripting soon.
Read Wiki about "Running a search from catalog":
http://88.191.26.34/XYwiki/index.php/Ca ... ame_Search
-
luckman212
- Posts: 9
- Joined: 09 Jul 2008 16:58
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
Yes, this has been talked about before - and I'd be interested as well - and I believe it is somewhere on Don's list. So it'll come, eventually.
If we want to talk about this, here's what I would suggest:
loadtemplate <template name>, <options>
With
<template name>
the name of the template to load
<options>
A combo of:
r: Run search
l: load Location
e: load Excluded folders
Default being "rl"
Now there could also be a command find, but that's a whole lot more complicated to come up with, and unless I'm wrong a search template is only one INI file anyway...
In fact, because it is an INI file, you could have your script to write a default INI file (which will be even a lot easier once command write is implemented) and then use setkey to adjust some values according to whatever you want (eg. ask user (input) for keywords, etc)
If we want to talk about this, here's what I would suggest:
loadtemplate <template name>, <options>
With
<template name>
the name of the template to load
<options>
A combo of:
r: Run search
l: load Location
e: load Excluded folders
Default being "rl"
Now there could also be a command find, but that's a whole lot more complicated to come up with, and unless I'm wrong a search template is only one INI file anyway...
In fact, because it is an INI file, you could have your script to write a default INI file (which will be even a lot easier once command write is implemented) and then use setkey to adjust some values according to whatever you want (eg. ask user (input) for keywords, etc)
Proud XYplorer Fanatic
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
The "Loadtemplate" example is ideal, but i guess apart from options there can be also be some sort of index to the ini keys which user can refer to and set. The key set by user is changed and rest is default.
But on the other hand user can also use set and getkey commands to access them.
I guess, the first method (where syntax for each search criteria will be set by Don) will be a lot easier for most users.
But on the other hand user can also use set and getkey commands to access them.
I guess, the first method (where syntax for each search criteria will be set by Don) will be a lot easier for most users.
-
luckman212
- Posts: 9
- Joined: 09 Jul 2008 16:58
Well, I feel loadtemplate is more accurate since it loads a template, but the search needs to be run.TheQwerty wrote:It sounds good to me as well, but I think "LoadSearch" might be a better name for the command.
Also, for consistency sake, the button that already exists on the Search Templates window reads "Load Template", and since it would do the exact same it make sense to use the same caption, doesn't it?
Proud XYplorer Fanatic
-
j_c_hallgren
- XY Blog Master
- Posts: 5826
- Joined: 02 Jan 2006 19:34
- Location: So. Chatham MA/Clearwater FL
- Contact:
Well, given that button in that dialog panel says "Load template", and as there aren't any other templates now, I think jacky's name makes more sense.TheQwerty wrote:It sounds good to me as well, but I think "LoadSearch" might be a better name for the command.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
Not really. In that instance it's already established that the button is being applied to Search Templates, as the dialog's title and header both make it abundantly clear.jacky wrote:Also, for consistency sake, the button that already exists on the Search Templates window reads "Load Template", and since it would do the exact same it make sense to use the same caption, doesn't it?
However, if in the future there are other templates (perhaps for Reports or something), then "LoadTemplate" will be an extremely unfortunate name and will need to be deprecated. Why not plan ahead and avoid this complication by using a more descriptive name?j_c_hallgren wrote:...and as there aren't any other templates now, I think jacky's name makes more sense.
Furthermore, a user who is writing a script may not be familiar with Search Templates and will likely skip over "LoadTemplate" in a list of commands, because it is ambiguous to the type of template loaded and provides no clue that it's related to their goal.
While, LoadTemplate may perfectly describe what the function does, I believe most users will be using such a command to execute a search, and it doesn't communicate that well.
LoadSearch may not be a good name either, but it removes some of the ambiguity and avoids a problem if there is ever another Template.
-
serendipity
- Posts: 3360
- Joined: 07 May 2007 18:14
- Location: NJ/NY
-
j_c_hallgren
- XY Blog Master
- Posts: 5826
- Joined: 02 Jan 2006 19:34
- Location: So. Chatham MA/Clearwater FL
- Contact:
Or make the type of template the first required parameter, maybe? This would reduce the number of total commands yet still allow for other types if there ever was more than search.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.
No I think that would be a bad idea, since we have no idea if there will be other templates, what they would be (like) and how they'd be used.j_c_hallgren wrote:Or make the type of template the first required parameter, maybe? This would reduce the number of total commands yet still allow for other types if there ever was more than search.
The options here only apply to search templates. And, for example, for reports it could only be a parameter to the "makereport" command, to specify which template to use...
Proud XYplorer Fanatic
XYplorer Beta Club