algorithmic modeling for Rhino
I am trying to make a wrapper for an executable.
Firstly about the executable: Once its open the following appears as you can see I need to enter an input between 1 and 4.
Once I've done that I then need to enter another input between 1 and 8.
After this the executable will create a textfile from which I need to read some values back into Grasshopper.
I'm having a lot of issues with how to open this executable and then enter the values from GH (Using a virtual keyboard?) I've tried the code below in Python
but I get an error and the command window closes immediately. I'm a bit lost on how to do this can anyone please point me in the right direction? I am using Python but if you know how to do this in C# or VB it would also be helpful.
I'm not sure how virtual keyboard will work for you but to run the line try this:
You are trying the wrong filepath and also you need to use "/" or "\\" or put an r before the address in the filepath.
Hope it helps,
Also as far as I can see there is a batch file "RunCalcSoilSurfTemp.bat" that should let you pass the arguments from the command line.
Thanks that line works the issue is now that I need to work out how to write a BAt file so that CalcSoilSurfTemp.exe uses the epw file.
Hi Anton, Try something similar to lines below in a bat file. You can pass the arguments using echo. In this example I'm sending 2 and 3 as inputs:
This are some seriously sexy options Anton.
I'm running a test now with a console app mockup and C#. I'll let you know what transpires.
I'm not getting anywhere invoking the app directly from C#. I attached the app here in case someone else wants to do some testing. It asks for two keypresses, then writes a file called output.txt in the same folder and exits.
Thanks for your reply, Sorry I dont really understand what you are trying to do here. Using Mostapha's tips Ive now got the exe opening but I dont know the best way to generate key events in Python in Grasshopper could you point me in the right direction?
Just for everyone's future reference the best way to approach this is to create a bat file which then opens a text that contains the key strokes an explanation of this can be seen here:
http://steve-jansen.github.io/guides/windows-batch-scripting/part-4..., you need to use redirection to send inputs into a exe.