Using Scripts in Ignite Scripting
To start using scripts, go to Scripting -> Run Script. This will open the scripting tab.
Ignite Scripting will sequentially run through every line in the script, from top to bottom, and perform the functions listed in those lines.
Lines preceded by “//” are ignored by the program and you can use these for notes.
Spaces / empty lines are also ignored, but it can be a good idea to leave gaps between lines so they can be read more easily.
Let’s go through an example script – designed for automatic registration for an account at WordPress.com
Writing an Example Script
Line 1 is preceded by // and is a note, so we can ignore it.
REGISTER – Tells Ignite that this is a registration action.
function main() ( – This must be present at the top of all scripts. The open bracket “(” at the end of this line is important. In fact, the script itself is enclosed between this bracket and the closing bracket “)” on line 30. After this line, all active lines in the script itself must end with “;”.
Open (“http://www.wordpress.com/signup”) ; – Tells the browser to open the wordpress.com signup page.
Input (“blogname”,”$username”) ; – An “Input” is a form field to be filled in. This line tells Ignite that it should fill the form field named “blogname” with the value we entered into the username field in our profile. The $ sign indicates that the value is linked to the profile. If you wanted, you could put any value here e.g. 12345 and it would be entered into the field named “blogname”. To find what a form is called, you may have to look at the source code of the webpage it is on. Alternatively, using Firefox, download the “Autofill Forms” addon, and right click “display form details” on the webpage to have all the form field names appear in yellow.
The other “Input” commands follow the same logic.
Form(2) ; – The wordpress.com signup page has 3 forms in total – a login form, a registration form, and a search form. We want to submit the third form – registration – so we tell Ignite to act on the third form on the page with this command. Form selection runs from 0 – so the first form is represented by 0, the second by 1, the third by 2 etc.
Submit () ; – This command executes the submission of the previously selected form (which was the 3rd form on the page – the registration form).
Remember the final closing bracket “)” on line 30 is essential.
ENDREGISTER – Tells Ignite that the registration phase has been completed.
A full list of scripting commands can be found here.
Running the Script
Now the script has been written, we can run it to see what happens.
If you are running a script for the first time, and are not sure if it is correct, it can be helpful to use the following:
Browser Visible – Shows the script running in a visible IE window.
Training Mode – Will slow the process down and break it into prompts, allowing you to check everything has been done correctly before moving on to the next stage in the script.
When you are sure the script is correct, you can turn these options off and run it in the background.