Tom L. Hall

President

 

TCC Publishing Newsletter

 

Issue 2

 

January 1, 2007

 

 


Welcome to the second in a series of Newsletters I plan on producing to keep you updated on things you can do to become a better ToolBook Author as well as teach you some of the fundamentals of you are just starting out with ToolBook or need a refresher on something.  The Newsletters will be aimed at the beginner to intermediate ToolBook Authors but from time to time, I will discuss advanced techniques.  In this issue, I will focus on system books.  At the end, I will provide a survey of some of the more commonly used ToolBook Resources on the Web.

 

In this Issue:

 

An Introduction to System Books

Creating a Custom System Book

Using a Custom System Book

Web Resources


An Introduction to System Books

 

System books (with an *.sbk extension) are files that live up the object hierarchy from your currently opened tbk file and are books that provide a great deal of the functionality both while you are Author level but also while testing and running a book at Reader level.  To understand a bit about system books, it is assumed that by now you understand a bit about the object hierarchy in ToolBook.  Just to be sure, each object exists at a certain level in ToolBook relative to any other object, and this includes the book as well as system books, with the system books existing at a level higher than the currently opened book.

 

If we take a look ahead at the Preview Release of Blackcomb (ToolBook Instructor 9), we find a host of sbk files including tb90.sbk, tb90a.sbk, tb90acta.sbk, etc. in the main ToolBook Instructor folder: C:\Program Files\ToolBook\ToolBook Instructor.  These files are used while authoring.  For instance, the tb90acta.sbk is the authoring system book (the “a” after “act”) that is used while you are using the Actions Editor.

 

 

Additionally, if we look in the C:\Program Files\Common Files\ToolBook\TBSystem folder, we find the runtime files and here you can see sbk’s such as tb90actr.sbk and tb90hyp.sbk.  For instance, the tb90actr.sbk is the runtime system book (the “r” after “act”) that is used for Actions Editor actions when you go to Reader level or deploy your tbk natively to CD-ROM, etc. using the Runtime files.

 

 

System books will typically have blocks of code that are handlers.  From within your currently opened ToolBook book, you can send a message up the object hierarchy and when it reaches the appropriate system book, the message is “handled” and the code for that handler executes.  Many times, these blocks of code will be functions and might return information back to the book and object that sent the message.  Often, we might send a message and forward it to make sure it goes on up the object hierarchy. 

 

When you observe the menu options on the menu bar, what is displayed is a result of having code out in one or more of those system books shown in the illustrations above.  When you make a choice, the code that executes is code that exists in one of those system books.  In the illustration below, clicking on Object displays the Object menu. Clicking Properties for Page brings up a dialog box that actually exists out on one of those system books.  From that dialog box, selections are made that cause information to be sent back (returned) down the line to the current book.  For instance, you can use that Page Properties dialog box to change the Name of the page that you are on in the currently opened book.

 

 

 

top


Creating a Custom System Book

 

In addition to having the system books that are distributed with ToolBook, you can create your own.  Most often, you would do this to enhance your Authoring abilities.  If you deploy a Native ToolBook application (CD-ROM, etc.), you could also have a custom system book that contains special code you have created to do different things at Runtime.  In this section, I will concentrate on how you can add a custom system book that will help you be more efficient as an Author.

 

In this exercise, we will add a new menu item to the Menu Bar, naming it MyTools and then have several selections from the MyTools drop-down menu. 

 

  1. To save time in writing a lot of OpenScript code, click here to download a sample book script that will be used to create the custom system book.  Clicking on this link should bring the code up in your Browser window, and from there you should just be able to select and copy that text to the Windows Clipboard or save the file as a txt file to your hard drive.

 

 

  1. Now, open a blank ToolBook book and save it as MyTools.sbk.  The easiest think to do is to save it to the Common Files folder which is C:\Program Files\Common Files\Click2learn\TBSystem for ToolBook Instructor 2004.

 

  1. Use the Object, Properties for Book command to access the Book Properties dialog box. 

 

  1. Click the Script Editor icon to open up the Script Editor for the book.  Either import the txt file in that you saved or paste the text you copied from the Browser window you opened by clicking the link above.

 

This is the first part of that script:

 

to handle enterapplication

          forward

 

--- Start Add Menu Items.

 

          in mainwindow

          sysSuspend = false

          remove menu "MyTools" at author

          sysSuspend = true

          add menu "MyTools" at author

          end

          add menuitem "Set HTML Dir" alias "setprojdir" to menu "MyTools" at author

          add menuitem "Paste Text from Clipboard" alias "PasteText" to menu "MyTools" at author       

          add menuitem "Paste Image from Clipboard" alias "PasteImage" to  menu "MyTools" at author

          add menuitem "Show All Objects on Page" alias "ShowObjects" to menu "MyTools" at author

          add menuitem "Hide Selected Object" alias "HideSelection" to menu "MyTools" at author

          add menuitem "Show Book Path" alias "showBookPath" to menu "MyTools" at author              

          add menuitem "Show Number of Backgrounds in Book" alias "BgCount" to menu "MyTools" at author

          add menuitem "Compact Book" alias "compactbook" to menu "MyTools" at author

 

          add menu "Insert pages" in menu "MyTools" at author

          add menuitem "Copy Specific Page No." alias "CopyPageNo" to menu "Insert Pages" in menu "MyTools" at author

          add menuitem "Copy Specific Page Name" alias "CopyPageName" to menu "Insert Pages" in menu "MyTools" at author          

         

          forward

end

 

--- End of Add Menu Items Section.

 

 

There are likely many ways of doing this but this is what I have done over the years as my Custom System Book has evolved to what it is today with many dropdown menu items and many of those having cascade menus.  As a side note, I have a variety of pages in my system book and I use this to organize my code since my routines make calls to those pages and the code on those pages.  This also addresses the issue of having an upper limit to the amount of code you can have for any object.

 

We will eventually add this system book to the list of system books that load on startup of ToolBook for any book you open.  Here you see that we forward the enterapplication handler to move this message up the object hierarchy.  To make sure that the MyTools menu option does not already exist, I first remove it, and then make sure it is added with the add menu “MyTools” at author line.  Notice that I then start adding menuitems, the listings from the drop-down obtained by clicking MyTools from the Menu Bar at Author.  The first one is add menuitem "Set HTML Dir" alias "setprojdir" to menu "MyTools" at author and causes one drop-down item to be added: Set HTML Dir which is aliased to be setprojdir to simplify things. 

 

Note that the last few lines of code starting at add menu "Insert pages" in menu "MyTools" at author allows us to create a cascade menu where clicking on Insert pages from the MyTools menu will display a cascade menu with two selections: Copy Specific Page No. and Copy Specific Page Name.  Basically cascade menus can be used to organize your options and shorten the length of the drop-down menu.

 

Here is the handler for the first option: setprojdir.  As you likely know, unless you specify something different, when you publish your tbk file, a folder will be named Webexport and your book will be published to that folder.  Using this code, we can redirect that export to wherever we wish, or just put it into a folder named HTML one level below the tbk file’s folder.  Of course, you can always set this new folder directory location manually when you start to publish the tbk file, but the point is this: Use a Custom Menu option for repetitive tasks or just to have a way of doing things faster.

 

to handle setprojdir

          ASYMI_ProjectDir of this book=ASYM_pathOfFile(name of this Book)&"HTML"

end

 

Thus, what eventually happens once we add this system book is that we will see a MyTools menu like this.  Clicking on Set HTML Dir from within a book causes a message to be sent up to the Custom System Book that then causes the setprojdir hander to be executed.

 

 

 

  1. Now, back to actually doing this.  After you have added the script to the book, save your book again.

 

  1. We will now make sure we get this menu option each time ToolBook is opened and you are in a book at Author level.  Click View, Options to access the Instructor Options dialog box.

 

  1. Go to the Startup tab and click the Add button.

 

 

 

 

  1. Browse to the location where you saved your file and select it as shown here.  Recall it was suggested to put it in the Common Files/TBSystem folder.

 

 

 

 

  1. Now, click OK to continue as shown below.

 

 

 

  1.  To see this new Menu option, you must close ToolBook and open it again, opening a blank book or any book you have created.

 

 

Here you see the entire set of MyTools menu items along with the Insert pages cascade menu selections.

 

 

 

The great part about this is that you can now add functionalities but writing new handlers (or functions) and adding new Menu items or creating cascade menus.  Below is a view of some of what I use from my Custom System book where I have a Menu named TCCTools.  Notice that I have a great many cascade menus just to organize things and to keep the drop-down short.  In future Newsletters I will provide additional code to allow you to continue to build your own Custom System book.

 

 

 

 

top


Using a Custom System Book

 

In this section, I will discuss some of the basic things I have put into your first Custom System book.

 

Often, you will have a Word document or a PowerPoint file open that contains your Storyboard text and you will select some of that text and copy it to the Windows Clipboard.  As you have learned, especially if you have been in any of my training classes, most often you don’t want to just paste that text into a field in your ToolBook book since you probably have already set up your book and or templates and starters to have an approved style which includes the format of text to be displayed in a field.  The field has the formatting and you want the text to be pasted into that field to not be “rich”.  That is, you don’t care and you don’t want any special formatting to carry over from the Storyboard.  You have an Edit, Paste Special option from the ToolBook Menu, but then you have to choose Text (Text Only) from a dialog box.  This is three clicks and you have to remember what to choose.  With the Paste Text from the Clipboard option from the Custom menu, the handler shown below executes and we accomplish the same thing with one less click and no decisions to have to make from a dialog box.

 

--- Paste unformatted text into a formatted field.

 

to handle PasteText

          sysSuspend= false

          send pastespecial "text"

          sysSuspend = true

end   

 

Here’s another one that I find myself needing on occasions.  If I am in a hurry and have a graphic in PaintShop Pro or have copied something like Clipart from PowerPoint, then instead of using the suggested method of displaying graphics in ToolBook (using the Reusable Graphics Placeholder or Web Graphics Placeholder objects), I will just quickly do a copy and paste to add the image directly to my page in ToolBook.  A bitmap will be pasted in as a bitmap using the normal Paste option.  This is OK.  But if you have a gif or jpg file opened on your graphics program and you do a normal copy and paste, you get a picture object in ToolBook which is less desirable than a paint object, and you then might wind up having to or wanting to convert the picture object to a paint object.  Now, selecting Paste Image from Clipboard  from MyTools menu calls this handler in the Custom System book and we get what we want.  Otherwise, we would have to choose Edit, Paste Special and then choose an option from a dialog box.

 

--- Paste Clipboard graphic as a paintobject.

 

to handle PasteImage

          send pastespecial "bitmap"

end   

 

The Copy Specific Page No. and Copy Specific Page Name options are most important to me to make sure I do not get those stray extra backgrounds that we sometimes get when we just do a normal Duplicate or Copy and Paste of a selected page.  Take a look at that handler to see that I am also using the pastespecial function to accomplish this.

 

 

---Copy a specific page number

 

to handle CopyPageNo

          local mypageno

          ask "What is the number of the page you want to copy?"

          mypageno=it

          if mypageno<>null

                   go to page mypageno

                   send selectpage

                   send copy

                   send back

                   local tbversion

                   tbversion=char 1 of sysversion&char 3 of sysversion

                   send pastespecial "tb"&tbversion&&"Page"

          end if

end   

 

 

Finally, back to copy and pasting non-rich text into ToolBook.  Your natural instinct is to do CTRL+V which is the normal paste.  Denny Dedmore has supplied this:

 

---Use CTRL+Shift+V to do a Pastespecial, Text Only

---CTRL+V still does a normal paste of any formatted text.

 

to handle authorKeyDown Key, isCtrl, isShift

        if key = keyV and isCtrl = true and isShift = true

                bs = ASYM_BlockSuspend()

                send pasteSpecial "text"

                get ASYM_RestoreSuspend(bs)

        end

        forward

end

 

Now, if you remember (instead of having to use the option to Paste Text from Clipboard from the MyTools menu) to do CTRL+Shift+V, the text Clipboard contents will be pasted as “text only”.  This happens because this keystroke combination is not recognized by ToolBook as being something to do anything else and thus as the message goes up the object hierarchy, it stops at this handler in the Custom System book and the code executes.  As I write this, I have to admit that I have this shortcut built in and now that I remember I have this, I will do this more often than using the MyTools menu option.

 

To summarize, investigate the code for the other handlers and how the menu is set up and you likely will be well on your way to adding your own.  If not, sit tight in anticipation of the next Newsletter.

 

Credits

 

  • Peter Hoyt (Command Center, Inc.) is the author of the original Compact Book code
  • Denny Dedmore (Sumtotal Systems, Inc.) is the author of the CTRL+Shift+V code

 

top


Web Resources

 

In Issue #1 of this Newsletter, I mentioned several Web Resources, including the SumTotal Website, Denny Dedmore’s Website, and Peter Jackson’s Website.  In this section, I will discuss and present to you a comprehensive listing of the more commonly used Resources.

TCC Publishing, Inc.

The home page for my Website.  From this Home Page, you will find links to Demonstrations, Tutorials, and information about the various books I have currently in publication.

SumTotal Systems Web Site

The home page for the SumTotal Website. From this Home Page, you will find links to ToolBook, Training, and the SumTotal LMS products.

ToolBook Instructor 9 (Blackcomb) Preview

This link provides information about the upcoming release of ToolBook Instructor 9.

ToolBook Instructor 2004

This is the Home Page for ToolBook Instructor 2004. From this Home Page, you will find links to information about this release, ToolBook training, ToolBook support, a link to a trial download page, case studies, an e-learning showcase, and much more.

ToolBook Blog

A link to current postings about ToolBook by SumTotal employees including Brad Crain and Tim Barham.

Get Developer's Exchange Tools for Local

A link to a download page and information about the Developer’s Exchange Tools.

ToolBook Knowledgebase

A link to the ToolBook Knowledgebase where you can look up information about ToolBook using a keyword search.

ToolBook Downloads Page at SumTotal

Download Page for ToolBook related downloads at Sumtotal.

ToolBook Product Showcase

A link to a page where you can find demonstrations of a variety of e-learning products built using ToolBook.

ToolBook Product Discussion List

This link gives you access to the archives of the ToolBook Product Discussion List, as well as a link so you can join this list of many of the best ToolBook folks in the world.

Platte Canyon

This link gives you access to all the great information and resources provided by Jeff Rhodes at Platte Canyon.

ToolBook User's Conference

This link gives you access to information about past and future events. This is the best ToolBook Conference going and is a must for anyone wanting to have a good time, meet great people and learn a lot about ToolBook.

ToolBook Help (Denny Dedmore's Site)

Denny’s contains a wealth of information on ToolBook.

Peter Jackson's ToolBook Developer's Site

This is a must if you want to extend your current abilities in ToolBook.

ToolBook.org (Simon Price)

This is a news site and portal for ToolBook.  Keep an eye on this site for the latest news on ToolBook.

Mauro Rech's WebSite

Those of you that know or have heard of Mauro can appreciate the quality of his Website.

 

top


 

 

TCC Publishing, Inc

2055 Cherry Stone Lane

Greenville, NC 27858 USA

Internet Address: tomhall1@tcc-pub.com

http://tcc-pub.com

Phone: 252-758-4590

Fax: 252-758-4590