You are here: > Home > Support > ToolBook Knowledge Base
Services
talent management whitepapers

Knowledge Base

HOW TO AUTOMATE TEXT BEING TYPED INTO A FIELD

This Mini Lesson will describe using the Actions Editor to simulate text being typed into a field.

Although this could be done using the Simulation Object in ToolBook, it is a complete overkill to do so because its intended purpose is well beyond just typing text into a field.

As such this approach will simply use the an Action Timer catalog object and some programming to accomplish the task.

GENERAL OVERVIEW OF THIS CONCEPT

  • Put the actual text you'd like to see into a hidden text field.
  • Use an Action Timer set to 150ms. This controls the speed at which the text is typed.
  • Write Actions Editor logic to transfer the next character from the hidden field to the visible field.

     

ADDING A FIELD TO STORE THE ACTUAL TEXT TO BE SHOWN

Add a field named Source to your page, and add the text you'd like to see auto-typed. You can leave the field visible for now, but the goal is to hide the field once you've got this logic up and running. The user will never see this field - it is being used only to store the actual text to be typed. 

ADDING A FIELD TO SHOW THE TEXT AS IT IS BEING TYPED

Add a field named AutoType to your page. This is the field the text will be auto-typed into. Adjust the field settings as needed to preset the:

  • Font
  • Font Size
  • Text Color

As the text appears in this field, it will use these settings you apply.

ADD A BUTTON TO START THE PROCESS

What will control when the text starts typing into the field? In your case it might be the entering of the page, but for my purposes, it will be a button the user clicks.

Add a button to the page and give it the caption of Show Me.

ADD AN ACTION TIMER CATALOG OBJECT

The Action Timer catalog object is the key component to this entire process. It is the piece that is able to control the delay between the letters appearing in the field.

What's also handy about this Action Timer object is that it allows the user to interact with the page while the timer is waiting for the next letter to show. For example if you have a multiple choice question object on this page as well, the user could interact with it while your text is still typing away.

Add an Action Timer object from the Action Objects catalog category. Configure it as show below:

 

ACTIONS EDITOR LOGIC TO CONTROL THE TYPING EFFECT

The logic which controls the typing effect is broken down into:

  • The code in the Show Me button which starts the process
  • The code in the Action Timer which makes the letters appear one by one

This will require you to set up one Global variable named gCurChar. Once you have done this you can refer to that global variable within the following logic.

   Show Me - button

On Click
  Set text of Field "AutoType" to ""
Set gCurChar to 0
  Execute Play() of Action Timer "ActionTimer"

   Action Timer - catalog object

On Media Timing Event
  Set gCurChar to gCurChar + 1
  If gCurChar <= charCount ( text of field "Source" )
    Set text of Field "AutoType" to characters 1 to gCurChar of text of field "Source"
  End if

 



  Provide Anonymous Feedback About This Article