Find Command CLEAR switch

I'm having trouble getting the CLEAR switch to work with the Find Command. I've read the documentation and I can't see where I'm going wrong.

Here's my command line:

Find IN={sourcepath} NAME={dlgstring|Enter search string} COLLNAME="Quick Find" CLEAR RECURSE SHOWRESULTS=lister,tab QUIET

Every time it is executed (source is "F:"), the output collection does not clear from the previous search and I end up with the previous results combined with the new ones.

However, when I use the Find Panel, it works as it says. I must be doing something wrong here. Any ideas?

This is your lucky day. I had almost exactly the same button already made, for a different purpose. Give this a try, it works for me:

[code]@Set Collection = "Quick Find"
@Set FindFile = "{dlgstring|Enter the file name to search for:|}"

Find QUIET COLLNAME={$Collection} CLEAR SHOWRESULTS=source,tab NAME={$FindFile} RECURSE IN {sourcepath$}[/code]

Use this one instead. The previous one works. But if you click the Cancel button on its string dialog, you will be prompted twice. I believe, because Opus sets the {$FindFile} variable equal to an unanswered string dialog, which subsequently gets executed again.

[code]@Set Collection = "Quick Find"

Find QUIET COLLNAME={$Collection} CLEAR SHOWRESULTS=source,tab NAME="{dlgstring|Enter the file name to search for:|}" RECURSE IN {sourcepath$}[/code]

Thanks for your reply.

I pasted the last piece of code into a button and gave it go. I'm still getting exactly the same problem. :confused:

Is there a way to delete all the links from the collection without browsing to them first?

Perhaps I may have to redesign the code so it does the following, if possible:

  1. Ask for search string
  2. Open the "Quick Find" collection in a new tab
  3. Select all contents and Remove from Collection
  4. Then perform the search.

Seems like a long way around and I haven't tried it yet.

I'd be interested in knowing whether the CLEAR switch is simply broken or if I am not understanding something correctly.

Ken's last button works correctly for me. The collection is emptied before any new matches are added.

I tried it on my partner's machine (we are evaluating for a possible dual license).

Again it didn't work. My machine is running Vista 64-Bit and the other is Vista 32-Bit.

I've been over and over this for quite a long time now and I'd love to get to the bottom of this. I'm starting to go a bit loony :smiley:

I even tried restoring the DOpus Preferences to defaults and Ken's code still didn't clear the collection of the last results.

Strangely, the button in the first post worked fine for me without any changes. I'm running a test version of Opus so perhaps something's different there. Haven't had a chance to try with the current release version of Opus.

I doubt it will help get things working but this should be a slightly more reliable version of the command when dealing with spaces in names and search patterns:

<?xml version="1.0"?> <button backcol="none" display="both" label_pos="right" textcol="none"> <label>Quick Find</label> <icon1>#find</icon1> <function type="normal"> <instruction>@nofilenamequoting </instruction> <instruction>Find IN=&quot;{sourcepath}&quot; NAME=&quot;{dlgstring|Enter search string}&quot; COLLNAME=&quot;Quick Find&quot; CLEAR RECURSE SHOWRESULTS=lister,tab QUIET</instruction> </function> </button>

Right, I've got it working and I think I know why:

I moved the quotes in Ken's example:

NAME="{dlgstring|Enter the file name to search for:}" 

to

NAME={dlgstring|"Enter the file name to search for:"} 

and it appears to work.

Use Nudel's button variation then. Where you relocated to the quotes above is meaningless (they might appear in the dialog title).

I usually use @nofilenamequoting. The Opus command parser tries to be smart about quotes, and Jon has worked really hard at making it smarter. But there is always some scenario where it doesn't do as well.

Thanks for all your help and advice help guys. I think I have this one sorted now.

Although, just thinking, it would be nice to have a text box in a toolbar that I could type the text straight into and when I press ENTER it would perform an action. Sort of like the Command Field but with my own custom action.

Not sure if this is possible but it would be cool.

It's not possible at the moment but similar to an idea someone raised here recently.

(I think he wanted to type into a box and then press different buttons which would be able to insert the text into different commands, but it would make sense for such a box to have a default command that was executed if you pushed return as well. I think the ideas fit together well.)