Include

From UBot Studio
Revision as of 21:34, 20 November 2015 by LillyT (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This command is a Flow Command. The include command allows the inclusion and running of defined commands from another .ubot file.

This command works with the Define Command.

Select a .ubot file to include: the browse button allows the insertion of the complete file path for the .ubot file containing defines that will be included.

IMPORTANT NOTE: The Include Command will need to be the first command in any script. For example:

include("C:\\Users\\Documents\\Productivity Search.ubot")
ui text box("Include File Path:",#include file path)

The script above shows the include command as the first item in the script.


Example 1

The file being included contains the following define command:

define search for a keyword {
    navigate("google.com","Wait")
    type text(<name="q">,"Productivity Apps","Standard")
    click(<name="btnK">,"Left Click","No")
}

Include.jpg


Once the define command is ready, the file is saved as Productivity Search.ubot and closed.

A new instance of UBot Studio is opened and the include command dragged in from under the Flow Commands in the toolbox.

Hitting the browse button allows us to search our files for the .ubot file with the define commands we want included.

include("C:\\Users\\Documents\\Productivity Search.ubot")

Include0.jpg


Once a file path to the .ubot file is added, clicking ok on the include command adds a category titled with the name of the bot.

All the defined commands in the Productivity Search.ubot file are then listed underneath as ready to run commands.


Include1.jpg


To run the command, it is dragged into the scripting area.

include("C:\\Users\\Documents\\Productivity Search.ubot")
run command("Productivity Search","search for a keyword")

Clicking the button runs the command.

Include.gif


Example 2: Parameters

In this example, we want to make sure that the search term is easy to change in the main bot.

This means that a variable is inserted into the type text file typing the search term.

define search for a keyword(#searchterm) {
    navigate("google.com","Wait")
    type text(<name="q">,#searchterm,"Standard")
    click(<name="btnK">,"Left Click","No")
}

Once the script is included into the main script, and the command is dragged into the scripting area, notice that the command now asks for a value.


Include2.jpg


Once the script is run, the command will run and search for the specified search term.


include("C:\\Users\\Documents\\Productivity Search.ubot")
run command("Productivity Search","search for a keyword","Productivity Apps")

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox