OUTLAWEDTutorial1
TUTORIALNAME
Tutorial :: Using Outlaw Ed
DESCRIPTION
This should teach you how to create your first config.
AUTHOR
Aaangel

// Regarding the subject of commenting your TSS files anything that the script engine doesn't recognize
// it will bypass, that generally means you can create your own commenting tag. However I recommend you
// use one of the following

//
(* *)
{ }
<!-- -->

(*
   Since this TSS actually require that you have 2 specific plugins installed we need to tell eddie
   that it should only run this script if those plugins are present
*)

RequiredVisual:advText
RequiredGeneral:CPU Info

(* 
   Onto the use of Procedures
   Below we have our procedures (they need to be declared before begin), the 3 declared here are to let 
   eddie run incase of a user error (we'll get back to that in a little while). You can create procedures 
   as you like, if you have a block of code you use often make a procedure
*)

(*
   Our first procedure, it's called "wrongvisualproc" hence the name after "Procedure". You can
   call any procedure from the main piece of code simply by typing the name of the procedure you
   wish to run. They all share namespace, so if you set "caption" or similar in a procedure and
   then run SHOWHINT in the main code it will still show correctly.
   
   A procedure start with a "Procedure" statement followed by it's name, then the actual procedure
   code and then it's ended by the "EndProcedure" statement (and as always no statement is case sensitive).
   The small comment after the "PRocedure" and before "EndProcedure" is just to easily see what's what.
   If you don't like them you DON'T need them.
*)

Procedure WrongVisualProc
//
SELECT:oePlugin.listVis
caption:Wrong Plugin
hintdescription:You need to use the "advText" plugin
showhint
//
endprocedure

Procedure WrongGeneralProc
//
Select:AddSensorDlg.plugins
caption:Wrong plugin
hintdescription:You need to select the "CPU Info" plugin
showhint
//
endProcedure

Procedure WrongSensorProc
//
Select:AddSensorDlg.Sensors
caption:Wrong Sensor
hintdescription:You need to select the "Percent Usage" sensor
showhint
//
endprocedure

BEGIN

(* 
   The New directive "ON" is used to tell eddie in case of an error/event it should run this procedure
   Syntax is: ON <eventtype> <ProcedureToRun>
*)

// WRONGVISUAL is ran when the user drag a visual plugin, but it doesn't match what you have requested
ON WRONGVISUAL WrongVisualProc

// WRONGGENERAL is ran when the user have pressed "ADD" in the "Add new sensor" dialog and it doesn't match the plugin you requested be added.
ON WRONGGENERAL WrongGeneralProc

// WRONGSENSOR is ran when the user have pressed "ADD" in the "Add new sensor" dialog and the sensor doesn't match the sensor you requested.
ON WRONGSENSOR WrongSensorProc

// Show the basic information box
SHOWINFO

// Select the form button and hint it
SELECT:oemain.TOOLBUTTON1
caption:Create a form
Hintdescription:This button is used to add a form to your project, we will now create one for you
SHOWHINT

// Click the button
onclick

// Select the first form in eddie, 0 indicates the first form, 1 the second etc...
SELECT:FORMMGR,0

caption:Your new form
hintdescription:This is your form, your main display area. Here you can add new visuals.
Showhint
caption:Add a visual
hintdescription:Now we need to add a visual if we're gonna show anything
Showhint

// Since we need to explain something on the visual plugins in the palette, it would be a good idea to
// make sure that the visual page is showing. Use "SET" command on the item "PALETTEPAGE" to do this.
// Syntax: SET <item> <value>
SET PALETTEPAGE 0

// Select the plugin palette window
SELECT:oePlugin
// Show it (In case it's hidden)
SHOW

// Select the visual plugin listing
SELECT:oePlugin.listVis
caption:Visual plugins
hintdescription:The visual plugins (and there by what you can show in CM2) are listed here.
showhint
Caption:Drag advText
hintdescription:Now you need to drag the plugin labeled "advText" over to your newly created form and drop it there.
showhint

// Wait for the user to drag a visual plugin onto a form, remember to tell eddie what plugin you need to be dragged - Also make sure if
// you add this command to your tss that you have use REQUIREDVISUAL command so the user can't proceed because the plugin isn't installed
// also you should setup a procedure incase the user drags the wrong one. See the ON directive.
// Syntax: DragVisual <the visual you need>
WAITFOR:DragVisual advtext

// Again select the form
SELECT:FORMMGR,0

caption:Well done
hintdescription:Now for something to show in it
showhint
SELECT:oePlugin
caption:Plugin Palette
hintdescription:This window will hold all your plugins and as you've already seen it holds visual plugins on this page, we will now change page.
showhint

// Now we're moving onto the general plugins, so we need to display the general page instead of the visual on the palette
SET PALETTEPAGE 1

// Select the general listing
SELECT:oePlugin.ListGen
caption:General Plugins
hintDescription:These here are your general plugins (They determine what you can show in your CM2 config), they're what will eventually poll data.
showhint
caption:Drag Test
hintdescription:Now drag the "Test" plugin onto the visual object you just created
showhint

// Wait for the general to be dragged, this will trigger the "Add new sensor" dialog. When this dialog is showing, DragGeneral is triggered
WAITFOR:DragGeneral

SELECT:addsensordlg
caption:The Add sensor window
hintdescription:This dialog will help you doing the initial setup for your sensor. We'll start by a brief overview of what you're seeing on it.
showhint

SELECT:addsensordlg.plugins
// Plugin combobox
caption:Available Plugins
hintdescription:This combobox lists all your general plugins installed. The one you dragged over will automaticly be selected. You need to select "Test" to proceed.
showhint

SELECT:addsensordlg.sensors
// Sensor combobox
caption:Available Sensors
hintdescription:Here all the sensors available in your chosen plugin are listed. If you change the plugins in the previous box, the content of this box will change. You need to select "Random Numbers" to proceed.
showhint

SELECT:AddsensorDlg.radiogroup1
// Update type radiogroup
caption:Update type
hintdescription:Here you can choose how you would like the value to update. Well stick with "Interval" now and cover fixed in a later tutorial.
showhint

SELECT:AddSensorDlg.Edit1
// update every X second
caption:Choosing interval
hintdescription:Choosing the right update interval for a sensor can be a crusial thing. You can put in anything from 1 to ..., but the lower the value the more cpu you will use, so consider this if you're showing time one second would be prefered. But if you're showing free diskspace you might want to have a value more like 600 seconds (10 minutes) because diskspace doesn't change that often and you can therefore affort to have a little gap in the update interval.
showhint

SELECT:AddsensorDlg.Checkbox1
// Dedicated
caption:Using dedicated
hintdescription:Checking this box will cause the update to happen on a independent timer, this will eat xtra CPU power. But if you want to show something that is dependable on a reliable update interval, like CPU usage, network bytes received per second or just a second hand on a clock, you'd wanna turn this on.
showhint

SELECT:AddSensorDlg.Button1
// Add button
caption:Adding the sensor
hintdescription:When you're done with your initial sensor setup you click add to create the sensor. Don't be afraid, if you've forgotten something it will alert you as to what you have forgotten.
showhint

// When the "add" button is clicked on the "Add new sensor" dialog, DRAGGENERALCOMPLETE is triggered. You need to defined what plugin you need
// the user to have selected. If what your requested doesn't match what the user have selected, the WrongGeneral or WrongSensor events will trigger.
// and the dialog will remain open until the user selects the right one. If you use this command you should use the REQUIREDGENERAL command
// to ensure that the plugin is present before eddie will run this tutorial. You should also set up the error events. See the ON directive
WAITFOR:DragGeneralComplete test.random numbers

END