Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Apple Guide Complete / Part 4 - Scripting Guide Files
Chapter 10 - Guide Script Command Reference / Guide Script Command Descriptions
/ Specifying Conditional Execution


<Skip If>

You can use the <Skip If> command to specify a condition that determines whether the next panel should be displayed.

<Skip If> condition
condition
A condition function, either single or compound, that returns a Boolean value. Guide Script provides several built-in condition functions, such as radioButtonState and checkBoxState. You can also define your own condition functions using the <Define Context Check> command.
DESCRIPTION
You can use the <Skip If> command to specify conditional display of the panel specified in the following <Panel> command. Apple Guide skips the panel (does not display it) only if the condition evaluates to TRUE. Apple Guide displays the panel if the condition evaluates to FALSE.

This is the general structure of conditional display of a panel:

   <Skip If> condition
   #skip this panel if condition is true, display if false
      <Panel> "skip panel if condition true"
   #continue with other commands
   #always show this panel
   <Panel> "example panel"
You typically use conditional statements to dynamically adjust the sequence of panels presented to the user by specifying conditions that check the current state of user settings (such as radio buttons or checkboxes), other settings (such as the current date), or the state of the user's environment (such as whether a particular folder is open).

You can specify a single condition function or combine several condition functions into a compound condition using Guide Script's built-in compound operators AND, OR, and NOT; you can also use parentheses to further qualify the condition. For example:

#example of AND   functionA() AND functionB()
#example of OR    functionA() OR functionB()
#example of NOT   functionA() AND NOT(functionB())
#example of all   
         functionA() AND (NOT(functionB()) OR functionC())
SPECIAL CONSIDERATIONS
If a <Skip If> command immediately precedes a <Make Sure> command, the <Make Sure> command is not evaluated if the <Skip If> condition is true. For example:

   <Skip If> condition
   #skip this panel (and any <Make Sure> commands) if condition is
   # true; if false, evaluate <Make Sure> commands
   <Make Sure> makeSureCondition, oopsSeq #eval if condition false
   <Make Sure> makeSureCondition2, oopsSeq #eval if condition false
      <Panel> "skip panel if condition true"
   #continue with other commands
   #always show this panel
   <Panel> "example panel"
EXAMPLES
<Define Sequence> "How do I use the dictionary?"
   #check whether the dictionary file is already open -
   # if it isn't open, tell the user how to open it
   #(isDictionaryOpen is application-defined context check)
   <Skip If> isDictionaryOpen("SurfWriter Dictionary")
      <Panel> "instruct user how to open dictionary"
   <Make Sure> isDictionaryOpen("SurfWriter Dictionary"), "SwContSeq"
   <Panel> "how to use the dictionary"
<End Sequence>
<Define Sequence> "How do I add a word to the thesaurus?"
   <Panel> "AddWords intro"
   #OpenWindow is a context check defined in Standard Setup file
   <Skip If> OpenWindow('WAVE', "Thesaurus")
      <Panel> "AddWords open thesaurus"
   <Make Sure> OpenWindow('WAVE', "Thesaurus"), "SwContinueSeq"
      <Panel> "AddWords summary"
<End Sequence>
SEE ALSO
For information on the <Define Context Check> command, see page 10-172.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
12 JUL 1996