GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Automated Text Find?

Hello -

I've searched this entire forum and all the documentation but can't find a clear answer to what I'm trying to do. I have a folder that has a bunch of text files in it that change every day. I want to create a batch function that will search those files for existence of a specific text string and then provide some kind of notification if it's found. I see that there's an external find command, but I haven't been able to figure out how to create a button or external launch mechanism for it. Can anybody help?

Thanks very much

You could use the Opus Find command, with appropriate arguments, to automatically launch a search which tells you which (if any) files contain the string you're interested in. Let me know if you want to do that and I'll work out the parameters. (Also, will you always search for the same string and in the same path?)

The drawback to this is that while it tells you the names of the files which contain the string, it doesn't show you the lines inside the files. Sometimes that doesn't matter but often you're interested in the context that the string appears in. For that kind of thing you might want to look at using the findstr command that comes with Windows. The Grep Dir button in my Diff/Merge Toolbar is an example of using this from Opus.

Shout if you need any assistance!

Leo - thanks so much for your quick reply!

I can put together the script using the find command, but what I don't know is how I launch it. I'm hoping to use a scheduler to launch it on a periodic basis, so it'd have to be something I can launch from a command-line. I do not need to know the context within the file - just knowing it exists is perfect. I would also want the window to not pop up if there's no match, if that's possible. I set up a saved filter file so Opus knows what to search for.

My main question is: how do I launch a Directory Opus command from a command-line with our without Opus actually running. If that's even possible...

Thanks again

You can run any Opus command using:

dopusrt.exe /cmd

This will start Opus if it isn't already running.

dopusrt.exe isn't in the path by default so you'll probably need to use the full path to it, under Program Files\GPSoftware\Directory Opus.

If you use the internal Find command then I think it will always show a progress dialog and the results window. A bunch of improvements have been requested for automating the Find command but I don't know if they will let you make a completely silent one (i.e. not show results if there are no matches). You could request that as well though; no harm in asking.

Great! That's exactly what I needed. Thanks again,

Greg.