Define
Line 3: | Line 3: | ||
'''Name:''' The name of the command or function being created (please avoid using function or commands names that already exist within UBot Studio as commands and functions.) | '''Name:''' The name of the command or function being created (please avoid using function or commands names that already exist within UBot Studio as commands and functions.) | ||
− | '''Command or Function:''' Select "Function" when creating a custom function. Select "Command" when creating a custom command. | + | '''Command or Function:''' Select "Function" when creating a custom function that returns values. Select "Command" when creating a custom command that runs a task. |
− | '''Parameters:''' allows you to | + | '''Parameters:''' allows you to provide information into a command or function. |
− | == Example == | + | == Example 1 == |
Naming the command, placing other commands in the define command and clicking OK creates the command under the Custom Commands tab. | Naming the command, placing other commands in the define command and clicking OK creates the command under the Custom Commands tab. | ||
Line 31: | Line 31: | ||
For more information on how to create a function, please see the [[Return]] command. | For more information on how to create a function, please see the [[Return]] command. | ||
+ | |||
+ | |||
+ | == Example 2 == | ||
+ | |||
+ | Adding a parameter allows you to quickly pass information into a define function or command in order to control the way the command or function runs. | ||
+ | |||
+ | <pre> | ||
+ | Browser URL("bing.com") | ||
+ | define Browser URL(#website) { | ||
+ | navigate(#website, "Wait") | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | Notice that adding a paramter created a parameter within the the defined command called Browser URL. | ||
+ | |||
+ | Typing a url into the parameter in the define command and running the defined command navigates the browser to the specified url. | ||
+ | |||
+ | [[File:defineparam.gif]] |
Revision as of 18:38, 19 February 2014
This command is a flow command. This command allows you to define a custom command or function that can be used in your bot.
Name: The name of the command or function being created (please avoid using function or commands names that already exist within UBot Studio as commands and functions.)
Command or Function: Select "Function" when creating a custom function that returns values. Select "Command" when creating a custom command that runs a task.
Parameters: allows you to provide information into a command or function.
Example 1
Naming the command, placing other commands in the define command and clicking OK creates the command under the Custom Commands tab.
define search for a keyword { navigate("google.com", "Wait") type text(<name="q">, "Stina Nordenstam", "Standard") click(<name="btnK">, "Left Click", "No") } search for a keyword()
Running the script will run the commands in the defined command called "search for a keyword" as one command.
For more information on how to create a function, please see the Return command.
Example 2
Adding a parameter allows you to quickly pass information into a define function or command in order to control the way the command or function runs.
Browser URL("bing.com") define Browser URL(#website) { navigate(#website, "Wait") }
Notice that adding a paramter created a parameter within the the defined command called Browser URL.
Typing a url into the parameter in the define command and running the defined command navigates the browser to the specified url.