Set
From UBot Studio
(Difference between revisions)
(Created page with "Set is a Data Command. This command allows you to store a value in a variable. The command settings allow you to determine if you want the variable to be:...") |
|||
| Line 10: | Line 10: | ||
== Example == | == Example == | ||
| + | <pre> | ||
| + | |||
| + | navigate("http://www.google.com/", "Wait") | ||
| + | set(#color, "yellow", "Local") | ||
| + | type text(<name="q">, #color, "Standard") | ||
| + | |||
| + | </pre> | ||
| + | |||
| + | |||
| + | The above script will create a variable with the value "yellow" and fill the google search field with the value yellow. | ||
| + | |||
| + | [[File:yellowset.png]] | ||
| + | |||
<pre> | <pre> | ||
Revision as of 17:36, 22 March 2013
Set is a Data Command.
This command allows you to store a value in a variable.
The command settings allow you to determine if you want the variable to be:
Local: Specific to the command the variable is set to. It will not affect or be affected by another variable with the same name in a different command.
Global: The variable can be used everywhere and will affect and be affected by another variable with the same name in a different command.
Example
navigate("http://www.google.com/", "Wait")
set(#color, "yellow", "Local")
type text(<name="q">, #color, "Standard")
The above script will create a variable with the value "yellow" and fill the google search field with the value yellow.
navigate("http://www.google.com/", "Wait")
define tes2 {
set(#one, "blue", "Local")
type text(<name="q">, #one, "Standard")
}
define tes1 {
set(#one, "red", "Local")
type text(<name="q">, #one, "Standard")
}
tes1()
tes2()
Notice that each variable is set locally, and though they both have the same names, they do not affect each other.
One value is Red and the other is Blue.