A simple way to improve your workflow and minimize human error while authoring your application’s help book is to automate the indexing of your help pages.
Xcode provides a simple way to add automated steps to your build process with shell scripts. The Help Indexer tool can be called with command line arguments via a shell script. Add these two together and you have automated help indexing as part of your normal build process.
Here is how to set this up:
1. First, find your projects build target and expand the build steps:
2. Then Control-Click on the Target and select the New Run Script Build Phase menu item.
3. In the Script Phase Editor window type the following, replacing your root help path in the script:
/Developer/Applications/Utilities/Help Indexer.app/Contents/MacOS/Help Indexer ~/WorkSpace/LicenseKeeper/trunk/English.lproj/LicenseKeeperHelp/
Make sure there is a space between “Help Indexer” and your help project path.
4. Close the editor, rename your new build phase to something like “Index Help” and drag it to the top of the build phase list or other appropriate spot.
5. There is no step 5.
Now whenever you build your project, your help files will be automatically indexed for use in Apple’s Help Viewer.
Comments
2 responses to “Automatically Index your Help Book with Xcode”
When indexing non-English localizations, you might want to add some command line arguments. For example, in Vienna’s indexing script for
zh_CN.lproj
, I used the following:/Developer/Applications/Utilities/Help Indexer.app/Contents/MacOS/Help Indexer $TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/zh_CN.lproj/Vienna Help/ -PantherIndexing YES -Tokenizer 5 -UseRemoteRoot NO -IndexAchors YES -MinTermLength 1
.You can also set the input and output files to only index when the help files have changes, which I’ve done, but that’s probably more work than necessary. 🙂
Sweet! Thanks for the added info, Jeff.