User forums > General (but related to Code::Blocks)

CodeBlocks Scripting abilities

(1/2) > >>

tiwag:
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"


--- Code: ---//
// 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;
}


--- End code ---


Happy scripting !

takeshimiya:
Seems pretty easy and powerful. :D

Questions:
1) What on earth is that @?
I guess there isn't any need to use memory allocations/pointers/references.

2) Those wxString needs _T() wrappers to work in unicode mode, right?

3) What can be exposed from wxWidgets? Everything? only wxString?
It would be great if one could create some simple interfaces with XRC+AngelScript.

I'm thinking in a part of Code::Blocks that it will be useful: the New Project dialogs.
As is now, if you want to create some wizards, you need to do it with a plugin, like wxSmith does right now.
But that is not-so-great, because if you want to create let's say a SDL application, it seems an overkill to create a plugin only for that.

Would be something at least simmilar to this be possible with XRC+AngelScript?

tiwag:
most of the answers you'll find in "sdk/as/bindings/scriptbindings.cpp"

[edit] post a patch when you got XRC working with as ;-)

takeshimiya:

--- Quote from: tiwag on January 27, 2006, 07:08:38 pm ---most of the answers you'll find in "sdk/as/bindings/scriptbindings.cpp"

--- End quote ---

Sorry, but those are the current bindings, which doesn't answers my questions, please read :P


--- Quote from: tiwag on January 27, 2006, 07:08:38 pm ---post a patch when you got XRC working with as ;-)

--- End quote ---
I don't think it's even possible to do that with AngelScript, that's why I'm asking here :)

tiwag:

--- Quote from: Takeshi Miya on January 27, 2006, 07:11:20 pm ---
--- Quote from: tiwag on January 27, 2006, 07:08:38 pm ---most of the answers you'll find in "sdk/as/bindings/scriptbindings.cpp"

--- End quote ---
Sorry, but those are the current bindings, which doesn't answers my questions, please read :P

--- End quote ---
what else than the current bindings do you expect to be working ? ;-)

Navigation

[0] Message Index

[#] Next page

Go to full version