today i played a little with (angel-)scripts
in this thread i'll post from time to time some interesting scripts,
which should demonstrate specific details how to access CodeBlocks internals from scripts.
everybody who discovers interesting details is invited to post his scripts here too
(with some comments please, if the code isn't obvious)
for the start, my todays favorite "tiwag1.script"
//
// test scripting of CodeBlocks
//
const wxString scriptname = "tiwag1.script";
int main()
{
wxString msg;
int msgtype = scICON_INFORMATION;
msg = "running " + scriptname;
//Log() messages are going into "Code::Blocks Debug" tab
Log(msg);
msg = "trying to get Editor";
Log(msg);
Editor@ ed = EditorManager.GetBuiltinActiveEditor();
if ( ed == null )
{ //all editors closed at the moment
msg = "ERROR: got no active editor";
msgtype = scICON_ERROR;
}
else
{
msg = "trying to get Editors FileName";
Log(msg);
msg = "SUCCESS: active editors FileName: ";
msg += "\"";
msg += ed.GetFilename();
msg += "\"";
}
Log(msg);
Message(msg,scriptname,msgtype);
return 0;
}
Happy scripting !
Ok, I've answered myself 2)...
Editor@ type in order to match the definition for the method GetBuiltinActiveEditor()
Yes, I can see that it matchs the definition... but it doesn't answers why an @ is requiered (both from the binder viewpoint and the scripter viewpoint)...
As for 3), maybe you misunderstood, but I'm NOT asking what can be done with the current bindings, instead, I'm asking what bindings could be added in the SDK without much pain.
I know that the current bindings are wxString, wxStringArray, and the MessageBox's, but it's not what I'm asking.
I really don't know if it would be doable to create wxWidgets widget bindings to create dialogs.
But I guess it would be a very difficult task to do that, anyways...