RhinoScript vs SendKeystrokes

Hello,

I built a plugin based on voice recognition.
For a reasons that i ignore.

If I use RhinoApp.RunScript for starting a new command, I can not execute a second command with ‘RunScript’ or ‘SendKeystrokes’ (like ! _Box or just ! for cancel if I say “Cancel”).

If I use RhinoApp.SendKeystrokes for starting a new command, I can run the second command but SendKeystrokes unselect all object before send the string.

All tests without the speech recognizer work exept SendKeystrokes that are invariant (it unselect all object before send the string).

I assume that RunScript creates a new thread and not SendKeystrokes. I have good ?

To clarify the reaction between RunScript and SendKeystrokes in my plugin :

I say RhinoApp Then I say RhinoApp result
“Union boolean” RunScript("! _BooleanUnion", true) “Cancel” RunScript("!", true) not work
“Union boolean” RunScript("! _BooleanUnion", true) “Cancel” SendKeystrokes("!", true) not work
“Union boolean” SendKeystrokes("! _BooleanUnion", true) Unselect all previous objects “Cancel” RunScript("!", true) work
“Union boolean” SendKeystrokes("! _BooleanUnion", true) Unselect all previous objects “Cancel” SendKeystrokes("!", true) work

Have an idea why it works like this?

How can I prevent SendKeystrokes from deselecting all objects before sending the string?

Thank you,
jmv

(note: of course, I placed a RhinoApp.Wait before executing a command)

Hi @kitjmv,

Get rid of the ! character in front of _BooleanUnion.

– Dale

Hello @dale,

Yes, I saw that, thank you.

Can you explain to me the difference between the Run Script andSend Keystrokes commands, please ?

In some cases, SendKeystrokes also has a strange reaction. It’s probably because I do not understand everything.

First, why does RunScript stack events and wait to execute them? (which is not the case with SendKeystrokes)

jmv

Well, RhinoApp.RunScript passes the input string to Rhino’s command line parser. while RhinoApp.SendKeystrokes posts WM_CHAR messages, one for each character, to Rhino’s command line window.

– Dale

Thank you Dale,

This explains why I have to remove the “!” with SendKeystrokes, but I do not find why RunScript stops my event loop and not 'SendKeystrokes` …

jmv.