A variable can be assigned a value, which is subsequently used or simply
recalled later in the script. For example, the following two commands:
MyName = "joe user"
MyShoeSize = 12
set two different variables to two different values. The first variable, MyName, is
assigned to a text string, while the second, MyShoeSize, is set to a numeric value.
516 | Chapter 9: Scripting and Automation
You can also assign variables in terms of other variables:
MyIQ = MyShoeSize + 7
which, when placed after the two preceding lines, would result in the variable
MyIQ having a value of 19 (12 plus 7). When a variable name appears on
the left side of an equals sign, its value is being manipulated. When it
appears on the right side of an equals sign or within some other command,
its value is simply being read. You can carry out more complex mathematical
operations using various combinations of parentheses and the standard
operators (+, -, *, /, and ^ for addition, subtraction, multiplication, division,
and exponentiation, respectively).
Give Your Scripts an Interface with the InputBox and
MsgBox Commands
Some scripts are ideally suited to run in the background and perform a
sequence of tasks, and then simply exit when those tasks are complete. Others
require some sort of user interaction, either in the form of asking the user
for input or informing the user when something has gone wrong. For example,
this command:
MyName = InputBox("Please enter your name.
Pages:
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718