When I click 'Find' I often forget to clear the "Containing text" field or the "Date" field. So I made this little app to clear those things. This app clears the Find dialog fields:
- Containing text
- Date
- Time
- Size
- Type
- (Edit 03/27/2009: Version 2.1 — no longer clears the filename field. I found that annoying.)
Concept:
- Opus9 saves the find dialog data in /DopusLocalData (an Opus9 built-in alias)
- The concept is to go in there and clear out what we don't want before doing a find. I do that by executing a script before doing the find.
An example for testing purposes:
- Place OpusClearFind.exe file in C:\Temp\
- Set the Find button command to:
C:\temp\OpusClearFind.exe {alias|dopuslocaldata|noterm} Find
Details:
That should be enough info for the expert users. For the less experienced I'll go into some detail here. To edit what the find button does:
- Enter Customize mode: SETTINGS -> CUSTOMIZE
- Right-click on the button
- Select 'Edit'
- Select 'Advanced'
- Enter the commands:
C:\Temp\OpusClearFind.ahk {alias|dopuslocaldata|noterm} Find
Notes on Editing Opus9 Buttons
The above is the method to edit a button that does only one thing. If the button does more than one thing, i.e. right-clicking the button does something else and middle-clicking the button does something else, then to edit that button:
- Enter Customize mode: SETTINGS -> CUSTOMIZE
- Left-click the button. A menu should drop down.
- The menu items are: Left Mouse Button; Right Mouse Button; Middle Mouse Button.
- Right-click the menu item you want to edit, and select 'Edit' (I know. I was initially confused too, which is why I detail how to do it here.)
Customizing the App
The source for OpusClearFind.exe is OpusClearFind.ahk . This is an AutoHotKey script file. AutoHotKey is a free and incredibly powerful and useful scripting language (wwww.autohotkey.com). Download and install it. Then you don't need the .exe file, instead use the .ahk file. Specify OpusClearFind.ahk in the Opus find command instead of the .exe version. Then you may modify the OpusClearFind.ahk script to your heart's content. Here's the code:
;CLEAR OPUS9 FILE SEARCH FIELDS (file name, containing, file date, file time, file size)
;Version 2.0 12/31/2008
DopusLocalData = %1%
findosd = %DopusLocalData%\State Data\find.osd
FileRead, Contents, %findosd%
if not ErrorLevel ; Successfully loaded.
{
;;; (don't clear the filename) Contents := RegExReplace(Contents, "<name>.*</name>", "<name />")
Contents := RegExReplace(Contents, "<contains>.*</contains>", "<contains />")
Contents := RegExReplace(Contents, "<date_type>.*</date_type>", "<date_type>0</date_type>")
Contents := RegExReplace(Contents, "<time_type>.*</time_type>", "<time_type>0</time_type>")
Contents := RegExReplace(Contents, "<size_type>.*</size_type>", "<size_type>0</size_type>")
Contents := RegExReplace(Contents, "<type>.*</type>", "<type />")
FileDelete, %findosd%
FileAppend, %Contents%, %findosd%
Contents = ; Free the memory.
}
For example, if you don't want the Opus Find dialog "Name matching:" field to be cleared, just remove the line:
Contents := RegExReplace(Contents, "<name>.*</name>", "<name />")
(or comment out that line using a semicolon ; Edit 03/27/2009 I commented out this line for version 2.1.)
AutoHotKey notes:
NOTE: In the AutoHotKey scripting language you may also comment out a block of code using / to begin a block and / to end the block. However, the closing */ needs to be the first item on the line! (I've been bit by that which is why I remember that caveat. "Why does the script stop in the middle? It's as if the entire rest of the script was commented out.")
NOTE: To compile a *.ahk file into a *.exe file, just right-click on the .ahk file and select 'Compile Script'
Advanced
I created a special directory for all my AutoHotKey scripts and created an environment variable %AUTOHOTKEY% which points to the directory.
To create an environment variable:
- START -> RUN, enter "sysdm.cpl"
- 'Advanced' (tab of 'System Properties' dialog)
- 'Environment Variables' (button on Advanced tab)
- User variables. Click 'New'
- Variable name: AUTOHOTKEY
- Variable value: C:\Users\Public\_zProgramFiles\AutoHotKey
- Reboot. (The variable doesn't take effect until you reboot.)
%AUTOHOTKEY%\OpusClearFind.ahk {alias|dopuslocaldata|noterm}
Find
Edit 03/27/2009: Commented out the clearing of filename field.
References & notes:
- The AutoHotKey script above I copied from the example at: autohotkey.com/docs/commands/FileRead.htm
- (Another scripting program which complements AutoHotKey nicely is KeyText ([www.keytext.com](http://www.keytext.com)) With the two of them combined I can do quite a lot.)
- I'm only moderately good at Opus so far. Getting better at it. Wasn't sure how much detail I should give here. I took the approach of first giving an overview which gives experienced users all they need to know. Then go into detail for those less experienced who need a bit more detail.
- I'm not allowed to edit this post after I submit it. If there are any errors in the post just blame them on my dog. I blame everything on my dog. It's very convenient. Dog doesn't seem to notice. Oh, I am allowed to edit my post. That's nice.
-
Our Limited Time Guarantee
All programs and utilities are hereby guaranteed to be free from defects in workmanship and programming for a period of one (1) minute after initial release. After that, you must refer below to the fully limited lifetime warranty. This guarantee does not cover damage due to accident, misuse, abuse, negligence, or incompetence. We are not responsible for any incidental or consequential damage which might occur as a result of the explicit or implicit use of these programs, including and not to exclude the possible complete destruction of all software on said machine, including said machine itself, along with the building containing said machine, and various parts of the surrounding country side. This guarantee is valid only in the United States, except for southern California, and only between the hours of 8:00 AM and 5:00 PM whenever we feel like it. Void where prohibited.
Our Fully Limited Lifetime warranty
In the event one of our utilities does not function properly due to faulty workmanship or programming logic, we will:- For a period of one month after initial release, we will listen to your complaints and smile politely, occasionally nodding the head as if in agreement.
- For a period of one year after initial release, we will supply, at no charge to the user, sympathy and commiseration over any component of a program found to be inadequate.
This warranty gives you specific rights, and you may have other rights which vary from state to state. i.e. the state (of mind) you are in may affect the intensity of our sympathy.
(Just joking.)
OpusClearFind2.01.zip (194 KB)