Bat file to search local Audacity Manual

Help for Audacity on Windows.
Forum rules
ImageThis forum is for Audacity on Windows.
Please state which version of Windows you are using,
and the exact three-section version number of Audacity from "Help menu > About Audacity".


Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade at https://www.audacityteam.org/download/.
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
DickN
Posts: 445
Joined: Thu Jul 22, 2010 9:03 pm
Operating System: Windows Vista

Bat file to search local Audacity Manual

Post by DickN » Thu Aug 04, 2016 10:03 pm

Split from http://forum.audacityteam.org/viewtopic ... 36#p310536

Here's a Windows .bat script to search a local copy of the Audacity manual for a given word or
phrase. It doesn't make inferences nor support wildcards as Google does, nor does it support regular expression searches. It could be modified to do regular expression searches, and wildcards would then be supported too although the syntax might not be as simple as with Google.

The results are displayed as a file list, which is essentially a subject list so that alone gives a context for the keyword/phrase match. Files can then be selected for display on the default browser. I don't know how to open multiple tabs simultaneously, but if additional files are selected once the browser is open it may add tabs rather than open new windows. It works this way with Mozilla and Chrome, the only browsers I've tested with it so far.

Installation consists of editing the file to insert the pathname of your help folder, removing the '.txt' extension from the file name, and saving the .bat file to the Desktop (or elsewhere with a shortcut on the desktop).

Happy Hunting

- DickN
Attachments
AudManSearch.bat.txt
Windows batch script for searching the Audacity manual. Edit to insert pathname of your help folder, and remove the .txt extension.
(3.14 KiB) Downloaded 28 times

DickN
Posts: 445
Joined: Thu Jul 22, 2010 9:03 pm
Operating System: Windows Vista

Re: Central location to save plugins from Audacity updates

Post by DickN » Fri Aug 05, 2016 7:42 pm

Just a heads-up, there's a sequel coming for AudManSearch.bat. I eliminated the temp file and made a few other changes. I'll post it as soon as I fix a bug.

DickN
Posts: 445
Joined: Thu Jul 22, 2010 9:03 pm
Operating System: Windows Vista

Re: Central location to save plugins from Audacity updates

Post by DickN » Sun Aug 07, 2016 12:13 am

Here's the sequel, rev 1.1 of AudManSearch.bat. It eliminates the temp file and adds Rotating Selection and New Search. I wanted to add multiple keyword searches (AND rule), but there's something I need to learn first about how to get nested 'for's to work in Windows batch script. Maybe I should read a primer on Java instead - this is pretty basic.
Attachments
AudManSearch.bat.txt
Copy to desktop and edit to substitute the path to your help folder (instructions in file), then remove the '.txt' extension. Or you could remove the '.txt' first, then right-click the icon and select Edit.
(5.12 KiB) Downloaded 32 times

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Bat file to search local Audacity Manual

Post by Gale Andrews » Sun Aug 07, 2016 1:38 pm

Thanks, Dick.

Of course if the user runs the script from other than the C:\ drive, it only searches the current directory.

I don't know what to do about that unless you specify C through Z.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

DickN
Posts: 445
Joined: Thu Jul 22, 2010 9:03 pm
Operating System: Windows Vista

Re: Bat file to search local Audacity Manual

Post by DickN » Tue Aug 09, 2016 2:06 pm

Interesting. I tried running it from a thumb drive and, as you said, it didn't find files in the man directory. Oddly, it didn't get an error (which would have triggered the reminder to insert the pathname of the help folder) when it changed directory to \manual\man in that path (which includes the drive letter).

If you're running from a command line and type 'j:audmansearch', it works (j: is my thumb drive). I remember now from the DOS days, CD <drive>:\<path> changes the working directory only for explicit references to that drive. OK, the fix is obvious.

Henceforth I'll include running from a thumb drive in my testing, which will also expedite testing on 3 different systems. I doubt this would be an issue for most users (especially if they launch it from an icon on the desktop), so will save the fix for next rev which one way or another will include multi-keyword search.

Thanks for the bug report!

DickN
Posts: 445
Joined: Thu Jul 22, 2010 9:03 pm
Operating System: Windows Vista

Re: Bat file to search local Audacity Manual

Post by DickN » Fri Aug 12, 2016 12:59 am

Here's rev 2.0. It supports multiple keyword/phrase searches, returning files that contain all of them.
The drive:path bug is fixed, and IMO the script has a tidier interaction with the user.

Note that in rev 1, 'Q' just meant quit the display list and then start a new search if you want to, in rev 2
'Q' means quit and 'N' means start a new search.

There are some options for getting the path info:

Hard-coding (default option) is still in there and it works from any drive:path.
If the environment variable AudacityHelp is pre-initialized, it uses this with no editing required.

The other 2 options require removing 'rem 's from the file:

Option 2:
If run from a shortcut, the drive:path can be put in the "start in" parameter in the shortcut.

Option 3:
If the .bat file is saved in the Audacity folder, it finds the help folder relative to itself.
I like this version but I didn't make it the default because it's inflexible about where to put the .bat file.
Attachments
AudManSearch.bat.txt
Rev 2.0 - edit per instructions to insert folder path or enable your choice of options, then remove .txt extension.
(7.4 KiB) Downloaded 21 times

DickN
Posts: 445
Joined: Thu Jul 22, 2010 9:03 pm
Operating System: Windows Vista

Re: Bat file to search local Audacity Manual

Post by DickN » Fri Aug 26, 2016 4:44 pm

I have a "3quel" (rev 3.0).

It does inverse searches (Any files containing a negated term are excluded from the results, rather like a real search engine but without the spelling checker.). It also gives a count of the matches, just in case you were wondering how long that list is.

The path setting is somewhat automated. The .bat script checks for a pre-set environment variable first, then the "start in" path given in the shortcut, then the .bat file's own folder, for the help folder. The actual path used is shown at startup. The only case where any editing of the .bat file is needed is if user wants to hard-code the path, which then overrides the above.

- DickN
Attachments
AudManSearch.bat.txt
Local Audacity Manual Search .bat script rev 3.0 for Windows. Remove the ".txt" suffix and save file in the Audacity folder, or anywhere if running from a shortcut. Displays setup instructions if it doesn't find the help folder. More detailed instructions are given in the file. Does Inverted searches (prefix any negated search string with '-') and has somewhat automated help path setting.
(14.47 KiB) Downloaded 24 times

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Bat file to search local Audacity Manual

Post by steve » Fri Aug 26, 2016 5:51 pm

I don't use Windows, but there are several search applications available for all platforms. One that I tried recently is a Java application that works on Windows, OS X and Linux (requires JAVA to be installed), called Puggle. It's a bit old (2010), but I found that it works very well and when set up to search only the manual, it is very fast.
puggle.png
puggle.png (105.32 KiB) Viewed 923 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DickN
Posts: 445
Joined: Thu Jul 22, 2010 9:03 pm
Operating System: Windows Vista

Re: Bat file to search local Audacity Manual

Post by DickN » Fri Aug 26, 2016 11:29 pm

Reminds me of my aside at the end of my Aug 6 post out of frustration with cmd.exe - "maybe I should read a primer on java instead - this is pretty basic".

I should look into getting an IDE for batch files - I wonder if they really reflect the actual behavior of a batch program running without the IDE.

My next iteration was going to be a specialized version simply because I have use for a similar search on label tracks among an archive of Audacity projects. Think I'll save myself some work and try Puggle for that. I don't really want to index everything though - I assume that means creating a database of keyword occurrences so the files don't have to be re-scanned for each search. That would be wasteful in a library that doesn't get searched very often, especially when only a small part of each .aup file is pertinent to the searches. Can Puggle target particular tagged blocks in .xml files?

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Bat file to search local Audacity Manual

Post by steve » Sat Aug 27, 2016 8:16 am

Puggle creates a database on first use. From first launch of Puggle, setting the search directory, waiting for it to create the database, to getting my first search result, took perhaps 30 seconds. After that, search results are virtually instant. It has "extractors" for "documents", "music" and "pictures". I'm not sure what format documents it supports, but it has no problem with html. which is what we need for the manual. I think the "music" and "pictures" searches extract metadata from common audio / image formats. There's even built-in help, but I've not used that. The other nice "feature" is that it runs without elevated privileges (just ordinary user account).

For searching data that hardly ever changes, a database is the way to go. It scans the files once, then you get very fast searches whenever you need them. The database would only need to be rebuilt when you update the manual, and that only takes about 10 seconds on my old budget laptop for the entire manual.

Other than that, all I know about Puggle is what is written on its website http://puggle.sourceforge.net/

There are also a number of open source desktop search apps written in Python, and I found this article which may be of interest, about writing your own search engine using Python, HTML and JavaScript http://www.zackgrossbart.com/hackito/se ... ne-python/

Obvious advantages of JAVA or Python is cross-platform support.
Advantages of making a custom search engine for the manual is that it could be optimised for how the manual is written, giving different weightings for when a search term is found in a header, anchor, file name .... as well as the total number of occurrences in the file.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply