User forums > Using Code::Blocks

Launch Executables within a script

(1/1)

mariocup:
Hi Guys,

I want to add a new script, so I took the sample script and made some modifications.
The script is enabled and registerd with the option "Launch executables" in the security tab.

The following code adds a menu entry and then external application should be started.

--- Code: ---function GetMenu()
{
local entries = ::wxArrayString();
entries.Add(_T("mymenu/explorer"),1);
retrurn entries;
}

function OnMenuClicked(index)
{
switch (index)
{
case 0:
local executing = _T("explorer.exe");
::ShowMessage(executing);
local retval = IO.Execute(executing);
// local retval = IO.ExecuteAndGetOutput(executing);
break;
...

--- End code ---

In my case only the ShowMessage appears, but no external application starts. What I am doing wrong?

Thanks.

Mario

DonSixto:
What happens with ::wxExecute ?
I looks like a search path problem.
Try with "c:\\windows\\explorer.exe" or wherever win is installed.

mariocup:
Hi DonSixto,

I tried you modification but the application is not started. How can I use ::wxExecute within a script?

Thx,

Mario

DonSixto:
Assuming that IO.Execute is right, then your interpreter is configured not to let lauch external programs, specially if it is run inside a web browser.
What language is it ?  It looks like a .net app.

mariocup:
The language is called squirrel (http://squirrel-lang.org)

It is a strange behaviour. If I call external applications like insight (the executable is in $PATH)  the IO.ExecuteAndGetOutput(executing) works within a script. Other executables like explorer that are also in $PATH, are not started.

Navigation

[0] Message Index

Go to full version