I like the idea of having a script to your ground station. It is a way to implement some logic that your original GUI does not enable directly. It can also enable integration easily with other dlls and modules far beyond the original scope of the Mission Planner. The first thing I asked myself about when I found this "treasure" is what were the available variables and classes that I can already access, well I could not find a clear list, maybe I am not good at googling -which is true-. So I opened the source and tried to figure out myself.
The main start here is Script.cs it is where the engine class and scope class exist. what we want here is the scope class, it is the INTERFACE point where you can LINK outter world with PYTHON script.
scope.SetVariable (varname, realobject);
Using above function you can add more objects to link with and define names for it in Python. See the below figure where all objects are defined - and where you can add more if u want.
I traced back the added classes MainV2.comPort, MainV2.comPort.MAV.cs, this, this that are mapped to MavLink.cs , CurrentState.cs,Script.cs that means any public variable of function in these classes can be accessed from python script.
Lets open Mission Planner and open the script window and check the above conclusion:
In the above image you can see Script.SendRC …. You can find this function in Script.cs
Same for cs.alt which should exist in CurrentState.cs
Now you can get all the functions you want from these classes, you can even add your own classes and functions.
I hope you find my small blog is useful.