Plugins are installed in Badboy's installation directory in the "plugins" folder. Each plugin is contained in a directory inside this folder. Installing a plugin is done simply by unzipping the plugin (if necessary) and placing it's folder in the Badboy Plugin directory.
Plugins may also include other files in their folder which can be referenced by the plugin later on. A typical example would be to include HTML files to be displayed by the plugin when it opens a Plugin View.
As well as adding views and options to Badboy's toolbars and menus, Plugins can create tools in the Toolbox, to be used in scripts. This is done by calling the "addTool()" function on Badboy's plugin object (see below).
|tick()||If this function is defined then it will be called asynchronously by Badboy while the item is in scope|
|scriptTreeLabel||If defined this will be used as the label for the item in the script tree.|
The Plugin object exposes the following functions for plugin scripts to call:
|int addView ( String strTitle, String strPlugin, String strHTML )||Adds a view with the given name and loaded with html from the given plugin.|
|void bindKey ( int key, int dwModifiers, String strPlugin, String strCommand )|
The dwModifiers parameter must be one or more of the following values summed, indicating which additional keys apply to the binding:
|BSTR BrowseFile ( String type, String filter, String initialLocation )||Shows an open/save file dialog to browse for the location of a file.
|Window browser ( String windowName )||Return dispatch pointer to requested window. Window may be specified by name or by index in form ":n" where n is index.|
|Object createObject ( String progId )||Creates an instance of the named ActiveX Control.|
|int addTool(String plugin, String name, String scriptSrc, String iconSrc )||Adds a tool to the toolbox that is executed using the script defined in the given source
file. The source file is searched for within the plugin's directory and should define a
function named 'execute()' that badboy will call run the action when it is
played in the script. The execute() function must return true or false as follows:
The script may also define a global variable called 'scriptTreeLabel'. If it does so, this variable will be displayed as the label of the item in the script tree.
|Object addChild(LONG id, LPCTSTR strType, UINT nIndex)|
Creates an instance of the requested item type as a child of the given item with given id in the script and returns it. If nIndex is greater than zero then the child is created at the specified index, otherwise it is created as the last child of the item.
Example: to add a new Step to your script as a child of item 234:
|void addToolBarButton(String strPlugin, String strCommand, String strIconSrc, String strDescription, String strOptions)|
Example: to add a toolbar button that shows an alert box using an icon called 'test.png':
|String getPreference(String strName)|
Attempts to retrieve and return named preference.
Example: to find the number of undo levels -
|Int setPreference(String strName, String strValue)|
Attempts to set the named preference with the given value.
Example: to set the number of undo levels to 25 -
|String showPopup(String strPluginName, String fileName)|
Displays a popup window loaded from the given filename in the given plugin's directory.
|String execScript(Object window, String strScript, String strOptions)|
Executes the given script in the context (domain, etc.) of the given window.
strOptions is reserved for future use.
To make a simple example plugin, perform the following steps:
When you restart Badboy you should find that the plugin adds a new view to your Badboy window which contains information that updates as you play your script and tells you how many items have played and also the number of links on the current page in the main browser window.
You will also see that a new entry has been added to the "View" menu to show the plugin in case the user closes the plugin's view.
We can extend the previous example to add a tool to the toolbox. The tool will simply set a Badboy variable named "hello" with the value "world":
After performing these steps you should have a new item in your toolbox called 'my tool'. By dragging it to your script you can make it play as part of your script.
|Show Statistics In Tree|
|Suppress JScript Errors|
|Disable Response Recording|
|Enable Direct Downloads|
|Results Listener Port|
|Record Passive Navigations|
|Record Passive Navigation Timeout|
|Server Log File Location|
|Enable Server Log Capture|
|Label Manual Screen Shots|
|Legacy Report XML|
|Summary Style Sheet|
|Show Summary Descriptions|
|Enable Custom User Agent|
|Custom User Agent|
|Root Item Type|
|Enable Recording on Startup|
|Diff Capture Output|
|SMTP From Address|
|SMTP Display Name|