Author Topic: How to modify default.conf with a script  (Read 4683 times)

mariocup

  • Guest
How to modify default.conf with a script
« on: March 22, 2007, 04:19:22 pm »
Hi,

I would like to modify the default.conf with a startup script to add new tools. The default.conf is a xml based file. How can I read and write into this xml configuration.

Thx,

Mario

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5504
Re: How to modify default.conf with a script
« Reply #1 on: March 22, 2007, 04:29:48 pm »
well our advice is off course, don't mess with the default.conf file.

If you want to manipulate it yourself, be sure you know what you are doing. Since it is an xml file, you can study it and manipulate it with TinxyXml. Just make sure all fields you didn't touch remain the same. If you burn yourself don't blame us ;-)

Cheers.

mariocup

  • Guest
Re: How to modify default.conf with a script
« Reply #2 on: March 22, 2007, 04:54:17 pm »
Hi killerbot,

perhaps it exists  a better solution than modifying the default.conf. For embedded Targets like MSP430, TriCore etc. I want to use an external debugger like insight.
I tried to write a script that is loaded at startup. But the script is not trusted, therefore a  popup ask for trusting it. If a terminate the external application (insight), CB returns an error.
Is it possible to trust a script on startup and give the ability to start external applications. The strange thing if I replace msp430-insight with explorer.exe and IO.Execute(executing) no application is started.

Code
function OnMenuClicked(index)
    {
                switch (index)
                {
                case 0:
                        local activetarget = GetProjectManager().GetActiveProject().GetActiveBuildTarget();
                        if (!IsNull(activetarget))
                        {
                            local outputfile = GetProjectManager().GetActiveProject().GetBuildTarget(activetarget).GetOutputFilename();
                            local basepath = GetProjectManager().GetActiveProject().GetBasePath();
                            local executing = _T("msp430-insight ") + basepath  + outputfile;
                            local retval = IO.ExecuteAndGetOutput(executing);
                        }
                break;
                }
    }

Thx,

Mario

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5504
Re: How to modify default.conf with a script
« Reply #3 on: March 22, 2007, 06:01:29 pm »
I am not into scripting (yet), I think the you will have to ask the big boss (Mandrav) ;-)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: How to modify default.conf with a script
« Reply #4 on: March 22, 2007, 06:40:30 pm »
Is it possible to trust a script on startup and give the ability to start external applications. The strange thing if I replace msp430-insight with explorer.exe and IO.Execute(executing) no application is started.

Yes! It is possible to load a script at startup. Click Settings > Scripting menu and a new window will pop-up. There you can specify scripts to load at start-up. On the Security tab of the pop-up window, check Launch executables to launch any external executables at start-up.

But if you want to add the script to menu, then it won't be loaded at start-up. :)
Be a part of the solution, not a part of the problem.

mariocup

  • Guest
Re: How to modify default.conf with a script
« Reply #5 on: March 22, 2007, 07:39:29 pm »
Hi Biplab,

that is right. I have tried this already. But I need that the steps:
Add  Settings > Scripting menu
load at start-up and set  Launch executables (Security)
are done with a script. Because if the user are running Code::blocks with a external debugger, the menu should appear without any interaction.

Thanks,

Mario