Frequently Asked Questions (FAQ)
Question 1: Why can't I put the value of a variable at the beginning of a line like this example?
$F = Fname
$M = Mname
$F "said to" $M "that" b c b.
Answer: Because the use of $F on line 3, above, looks like a definition or re-definition of
variable $F—not the use of $F in that sentence. If it's important that the sentence actually
begins in column 1, then put a null literal ("") at the beginning of the line, like this:
""$F...
Otherwise, if spacing isn't important, put a space at the beginning or perhaps use the &i inline
function to indent the line like so:
$F...
&i$F...
Question 2: Why do I get only 1 space when I try to put 2 spaces following a period
or use multiple spaces to align text?
Answer: GAS generates the output by creating a standard HTML web page. Web browsers
automatically compress multiple spaces to one space. GAS is not in control of that situation.
However, GAS does have an inline function that can insert 1 to 9 spaces into the output text.
For example, &1 will insert 1 space, &2 for 2 spaces, etc., up to &9 for 9 spaces.
Question 3: What's the difference between $F created by the Fname function and the
&F inline function.
Answer: A variable like $F will have the value saved, and each use of $F in the generated text
will be the same value. The &F inline function creates a new random value each time it is used.
So, if you want to mention the same name in different places in the text, use a $ variable.
$F = Fname
"Using $F multiple times:" $F, $F, $F creates Robin, Robin, Robin
"Using &F multiple times:" &F, &F, &F creates Boni, Yolanda, Leslie
Question 4: Why are there two kinds of variables, like $b and #b?
Answer: The $ variables are defined by you, and their value remains unchanged unless changed
by you. The # switch variables are defined by GAS, and don't create visible output. What they do is control
the format of the text. They automatically switch between ON and OFF by themselves. For Example,
the #b switch will turn boldfacing on the first time it is seen, and boldfacing will stay on until #b is used
the second time.
The # switch variables can control more than text format. Other HTML features are controlled by this
On/Off action. Most notably for GAS, they can be used to create tables with single line borders and shaded
headings. The Making Tables with Switch Variables reference guide shows how this is done.
Question 5: Why are $ variables case sensitive and # variables aren't?
Answer: The $ variables are case sensitive so that you can have more of them, and allows for things
like the Buzz and State functions to return two variables that should go together instead of just one value.
For example, you probably would want the acronym for a buzz phrase. Likewise, you might want the
abbreviation for a state along with the state name. Here's how that works:
$S = State
$B = Buzz(c)
"The State function returned: $S and $s" creates The State function returned: West Virginia and WV
"The Buzz function returned: $B and $b" creates The Buzz function returned: Balanced Policy Software and BPS
In the case of switch variables, there's no need for two different values since the On/Off switching is automatic.
However, you might want to use case as a mneumonic device to remind yourself of what you want the switches
to be doing. For example, you might want to use #B to turn bold ON and #b to turn it OFF, like this:
"Let's #Bboldface#b some text." creates Let's boldface some text.
Question 6: When are variables and inline functions active inside literals?
Answer: Any time text is being generated, $ variables, # switches and & inline functions are active
inside of quoted literals. So, if you want to have a $ in the output, you need to use ^$ to see it so that the
character after the $ won't be seen as a variable name. You can see this in the Question 5 answer, above.
However, if that literal was stored in a variable, and the variable is inserted into the text, you get something like this:
$A = "Let's #Bboldface#b some text."
"Variable A: $A" creates Variable A: Let's #Bboldface#b some text.
In Question 5, the literal was on a line creating output. In Question 6, the same literal enclosed the value to be
stored in a variable. Back on the GAS main page, select the Make a CSV File with Loop sample GAS script to see
how this difference can be used to your advantage.
Question 7: What are "unquoted literals" mentioned in the function descriptions?
Answer: There are two functions where the parameters enclosed in parentheses are unquoted literals.
The Generate function treats everything between the left and right parentheses as a line to be interpreted and stores the
result in the variable. Here are examples of Generate parameters. The unquoted parameter creates
a book or research paper title by replacing the letters with phrases just like an interpreted script line.
$a = Gen(M i)
$b = Gen("M i")
"Variable a: $a" creates Variable a: Stability predictions of any teaching process revision
"Variable b: $b" creates Variable b: M i
The List function parameter is a comma-separated values list of words or phrases that you want to insert in the generated
output text, yet have each reference to the variable return a different value. The list items are returned in random order.
If you reference the list variable more often than the number of items, the list re-randomized.
$g = List(Howdy,Hello,Hi,Greetings,Aloha,Bonjour,Hola)
$G = "$g &x" Note: $G is a pattern for the output line—an item from $g plus a first name.
$t = loop($G,1,5) Note: Five lines will be stored in $t, then displayed by the next line
""$t
Bonjour Marcella
Greetings Sharon
Hi Dennis
Hola Prostell
Hello Teddy
The sample GAS script User Defined Connector Lists is an example of how to add new Suffix Connectors to the output
for more variety.
Question 8: Are there any letters not being used for phrases?
Answer: Not exactly. The only letter that doesn't return an actual phrase is P.
In this case, P returns a single noun like
system, process, etc. mainly used in conjunction
with a buzz phrase, like so:
$B = Buzz(C)
"&X is in charge of the" $B ($b) P. creates Paula is in charge of the Total Management Capability (TMC) Model.
Question 9: What are those ! lines at the top of some sample scripts?
Answer: These are special commands that tell GAS how to change the default style of the generated text page. For example, !Color can be used to change the background color of the generated page. A Color Chart is available for reference.
The Style Controls reference guide on the GAS page explains each command.
Question 10: How do I save part, or all, of the text from a generated page?
Answer: GAS is a server application. It has no access to your computer for storage, and no way to save your script on the server.
1. Since you are running GAS from your browser, you can easily use the clipboard to send and receive script between your text editor and the GAS editing control. Please note that every time you copy script from off-line to GAS and press the Generate button, the new generated page will be re-randomized, even if you didn't make any editing changes. That's exactly what would happen if you press Generate multiple times.
2. If what you want to save is the actual generated text, then (a) select the part of the generated text you want to keep, (b) copy it to the clipboard, and (c) paste it into a file on your computer. Only the raw text, without any formatting controls will be saved this way.
3. If what you want to save is the actual page exactly as it appears with all the formatting, then (a) Right-Click anywhere on the generated page, (b) select the View Page Source option, (c) select all the text, and (d) make sure to save the selected text to a file with an .HTM or .HTML extension.