Author Topic: EXEC command to run external programs  (Read 1488 times)

0 Members and 1 Guest are viewing this topic.

Seseel_Lybon

  • Youngling
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
EXEC command to run external programs
« on: February 22, 2017, 02:42:40 AM »
Hello,

A long while back I was tinkering with what I called DBSE; something involving the C++ preprocessor to allow me write commands for deepbot in a C-style and then convert them to the DB command syntax.
The project didn't really take off because it turned out that the command parser is a little 'weak'.
(No offence. I just isn't powerful enough for my 4kb commands :p )

Still wanting to write more complex commands, like mini-games, for chat, I recently came up with an interesting solution/request;
in various languages it's possible to run programs from your program to deal with other stuff.

I can write a C++ program that runs a Python program that captures the result of said Python program and does something with it. It's slow, rather expensive qua resources, but I think it opens a ton of options.

It's really for advanced users of the command system, so not many people would be that interested in it.
And it's there's the safety issue of people running scripts they've no clue what they do.

I imagine it looking a bit like:
@exec@[ programlocation/file, any_parameters_you_want_to_pass_on ]
and it returns whatever the program returns.

From what I found, C++'s exec() is
http://stackoverflow.com/questions/17736407/c-sharp-equivalent-to-fork-exec
thingy in C# (which is what I recall is DB written in).

I'm a really messy, random person-thingy. So please ask if something doesn't make any or enough nonsense.

~Seseel Lybon

[added]
I just remembered there is already an exec command. But that only runs internal commands.
I want to run an external program.

TheNumbLock

  • Advisor
  • Councilor
  • **
  • Posts: 4776
  • Karma: +137/-5
    • View Profile
  • Twitch Name: TheNumbLock
Re: EXEC command to run external programs
« Reply #1 on: February 22, 2017, 08:09:09 AM »
The problem with adding this to exec other programs, is very risky. If the dev can limit @exec@ to only run in the Deepbot folder, it may be okay. But still a risk for mods or someone making a command that can be harmful.

I am no way against the request, just stating why it may be denied or not added. I do like the idea to be able to exec programs. I can imagine how amazing this feature could be. :)
Old Name: RepentGamingTV
Twitch: Here

Need help ASAP?
Join Deepbot's Discord: Discord.Deepbot.tv
Deepbot's Twitter: @DeepSupport

MrArca9

  • Youngling
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
  • Twitch Name: MrArca9
Re: EXEC command to run external programs
« Reply #2 on: March 02, 2017, 03:03:45 AM »
If you want use autohotkey scripting to run the file you need.

Here's how I do it:

Use the bot to save anything to a trigger file. (!command - write to file)

Have autohotkey checking that file (the trigger file) every x seconds.

When autohotkey sees that the file has something in it, reset the file (overwrite with empty string) , and run your EXE you want ran. Tada!