Espera, the function "HandleCommand" is what you're looking for. It's what's called whenever you enter a command at the input line. You can just call it yourself from your scripts.
To add it from the GUI, add a "Call Function" script command. Set the function name to HandleCommand. You then need to add two args.
The first argument is the command you want to execute. It will be a string, so you need to put it in quotes (e.g. "take apple").
The second argument to add is just null.
In Code View, it would look like:
HandleCommand("take apple", null)
It does everything that happens when you input a command, including echoing it to the screen like "> take apple".
Hope that helps!