{"id":196,"date":"2022-11-09T09:58:31","date_gmt":"2022-11-09T08:58:31","guid":{"rendered":"https:\/\/fred.appelman.net\/?p=196"},"modified":"2022-11-09T09:58:31","modified_gmt":"2022-11-09T08:58:31","slug":"creating-a-help-book-for-a-macos-application","status":"publish","type":"post","link":"https:\/\/fred.appelman.net\/?p=196","title":{"rendered":"Creating a help book for a MacOS application"},"content":{"rendered":"<div class=\"entry\">\n<p>The process to create an help book for a MacOS is not very well documented. The available documentation is old and archived: <a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/Carbon\/Conceptual\/ProvidingUserAssitAppleHelp\/authoring_help\/authoring_help_book.html\">link<\/a>.<\/p>\n<p>From that old documentation and some of the information <a href=\"https:\/\/developer.apple.com\/forums\/thread\/667260\">found<\/a> on the Apple Developer Forum I was able to create an Help book for a <TT>SwiftUI<\/TT> application.<\/p>\n<h2>The book structure<\/h2>\n<p>Assume that the name of the application is <strong>XXX<\/strong> and the author has domain <strong>bogus.com<\/strong>.<\/p>\n<p>Create The following structure:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/fred.appelman.net\/wp-content\/uploads\/2022\/11\/tree.png\" alt=\"Tree structure\" title=\"tree.png\" border=\"0\" width=\"368\" height=\"150\" \/><\/p>\n<p>The files in the directory <tt>English.lproj<\/tt> are the content. So a main page <tt>index.html<\/tt> which loads some logo from the file <tt>utl_download_9531nu_logo.svg<\/tt> and has a link to a secondary page <tt>mainPage.html<\/tt>. The content is fully free, it is just standard <tt>HTML<\/tt> and the main page doesn&#8217;t even have to be named <tt>index.html<\/tt>.<\/p>\n<p>The file <tt>Info.plist<\/tt> has the following content:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/fred.appelman.net\/wp-content\/uploads\/2022\/11\/InfoPlist-1.png\" alt=\"Info plist content\" title=\"InfoPlist.png\" border=\"0\" width=\"577\" height=\"266\" \/><\/p>\n<p>Because the file is named <tt>Info.plist<\/tt>, the key names are translated to their textual meaning. If you temporarily rename this file to, e.g. <tt>XXX.plist<\/tt> it will reveal the actual key names:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/fred.appelman.net\/wp-content\/uploads\/2022\/11\/KeyNames.png\" alt=\"Raw key names\" title=\"KeyNames.png\" border=\"0\" width=\"570\" height=\"273\" \/><\/p>\n<h2>Enabling the help<\/h2>\n<p>Just creating the help book doesn&#8217;t have any immediate effect. It must be enabled in the <tt>Info.plist<\/tt> of the application. Add the following two keys:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/fred.appelman.net\/wp-content\/uploads\/2022\/11\/MainPlist.png\" alt=\"Enable the help\" title=\"MainPlist.png\" border=\"0\" width=\"581\" height=\"91\" \/><\/p>\n<p>This file should already have other entries, but they are left out because they are not relevant for building a help book.<\/p>\n<h2>Create the index file<\/h2>\n<p>To make your help book searchable, you have to create a file named <tt>help.helpindex<tt>.<\/p>\n<p>On the command line run, the following command:<\/p>\n<p><tt>hiutil -Cf XXX.help\/Contents\/Resources\/English.lproj\/help.helpindex XXX.help\/Contents\/Resources\/English.lproj\/<\/tt><\/p>\n<p>This will create the file <tt>help.helpindex<\/tt>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/fred.appelman.net\/wp-content\/uploads\/2022\/11\/helpindex.png\" alt=\"Create the help index\" title=\"helpindex.png\" border=\"0\" width=\"395\" height=\"166\" \/><\/p>\n<p>Note that in order to make your index really searchable, your files should provide hints:<\/p>\n<p><b>Keywords<\/b><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/fred.appelman.net\/wp-content\/uploads\/2022\/11\/keywords.png\" alt=\"UntitledImage\" title=\"keywords.png\" border=\"0\" width=\"595\" height=\"101\" \/><\/p>\n<p><b>Abstracts<\/b><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/fred.appelman.net\/wp-content\/uploads\/2022\/11\/abstracts.png\" alt=\"UntitledImage\" title=\"abstracts.png\" border=\"0\" width=\"600\" height=\"77\" \/><\/p>\n<p>For more details see  <a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/Carbon\/Conceptual\/ProvidingUserAssitAppleHelp\/authoring_help\/authoring_help_book.html\">link<\/a><\/p>\n<h2>Installing the help<\/h2>\n<p>Finally, the help book must be copied when you build the application.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/fred.appelman.net\/wp-content\/uploads\/2022\/11\/install.png\" alt=\"Install bundle\" title=\"install.png\" border=\"0\" width=\"599\" height=\"221\" \/><\/p>\n<ol>\n<li>Select the name of the project<\/li>\n<li>Select the proper target<\/li>\n<li>Select the build phases<\/li>\n<li>Install your help book as a bundle<\/li>\n<\/ol>\n<h2>Run the application<\/h2>\n<p>Finally run your application and check out your help page. There is no need to make any change in your application to enable the help book.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The process to create an help book for a MacOS is not very well documented. The available documentation is old and archived: link. From that old documentation and some of the information found on the Apple Developer Forum I was able to create an Help book for a SwiftUI application. The book structure Assume that &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,10],"tags":[31,30,16,28],"class_list":["post-196","post","type-post","status-publish","format-standard","category-software","category-swift","tag-help","tag-macos","tag-swift","tag-swiftui","anons"],"_links":{"self":[{"href":"https:\/\/fred.appelman.net\/index.php?rest_route=\/wp\/v2\/posts\/196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fred.appelman.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fred.appelman.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fred.appelman.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fred.appelman.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=196"}],"version-history":[{"count":1,"href":"https:\/\/fred.appelman.net\/index.php?rest_route=\/wp\/v2\/posts\/196\/revisions"}],"predecessor-version":[{"id":197,"href":"https:\/\/fred.appelman.net\/index.php?rest_route=\/wp\/v2\/posts\/196\/revisions\/197"}],"wp:attachment":[{"href":"https:\/\/fred.appelman.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fred.appelman.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fred.appelman.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}