I have a script in Rhinoscript for automating/batching some computations in rhino remotely.
I use in my script Rhino.DocumentModified “False” to avoid the prompt asking to save modified file so if I write manually _Exit in the command line after executing my script, Rhino close itself without asking so is perfect.
But if I use in my script Rhino.Exit or Rhino.Command("_Exit"), this doesn’t work. Rhino is still opened.
I got Rhino closed if I play my script from Rhino Script Editor in Rhino but I need to call my script remotely, so I have to compile it as a plugin to be able to execute it outside the Editor, as a command in the Rhino Command Line.
Really I need to call Rhino from Windows command line, like this:
"C:\Program Files\Rhinoceros 5.0\System\Rhino.exe" /nosplash /runscript="myscriptcommand _exit" does not work because my script has several “Rhino.command(any)” sentences inside and if I do what you suggest then _exit is written in the rhino command line not at the end but in the middle and it does not work.
And if I write Rhino.command("_Exit") at the end of my script instead of Rhino.Exit then _Exit is written in Rhino command line by my script but it does nothing.
But what do you mean with “drag the rhp in rhino”? I install it as a plugin in Options menu. This way I have a command word to write in the command line, and everything in my script is executed but not Rhino.Exit or Rhino.command("_Exit").
I understand what you mean on the first part. If I create a plugin with only rhinoapp.exit and I run the command rhino closes. No idea why it wouldn’t work.
With drag and drop Its the same as installing it via the options menu.
Thank you very much for your help but I am stucked in the same.
If I drag and drop the .rhp file I have the same result than installing it in Options menu.
And if I use pause it does not work because I have several commands and rhino throws “pause” or “exit” as a command just after the first Rhino.command() of my script, not at the end of the execution of the entire script.
Because if I run /runscript=" -_exit" then it is perfect. Rhino opens and closes. The problem is when I try /runscript="myscriptcommand -_exit", becuse -_Exit is not written after the whole execution of all the sentences in my script. It is wriiten in rhino command line just after the first Rhino.command() of my script, having no effect, If it would close Rhino it will not be OK but I woud understand it!
When you say If I create a plugin with only rhinoapp.exit and I run the command rhino closes, you mean it works for you???
Yeah when I create a vb.net plugin. And indeed dragging and installing it with options has the same result.
I mean that you have to use pause in your script.
You said you use rhino.command() in your scripts? thats where I meant you have to throw the pauses
You can try to make a small command like you are making now. But then try to do rhino.command(line pause pause) then in you batch use _exit after the command.
I’ve trying with Pause in many places and nothing.
I don’t think this is good for me, because I am not expecting any user inputs. Actually I want to execute my script through my batch file so I don’t want any user interaction.
Thank you but I think the real problem is why Rhino.Exit does not work inside a plugin, or why it is not working for me.
At least I have the workaround with /runscript="-_LoadScript C:\myscript.rvb", where Rhino.Exit does close Rhino after execution, but I thought It is not much correct.
I’ve experienced the same issue when using a startup script for a command-under-construction in a BAT-file. The command-under-construction causes changes to the document and I found that the command “Exit” does not support RunMode Scripted. If running scripted it still shows a Yes-No-Cancel dialog instead of command line options.
I don’t know whether this is by design nor whether this is the cause of not being able to close Rhino from the /runscript argument.
Because of this issue, the issues mentioned above, and other limitations with command line scripting, such as a character limit, we recommend automating Rhino, using Visual Basic Script (vbs) for example, instead of running Rhino from the command line with the /runscript option. By automating Rhino with vbs, you can do everything can do using batch scripting, plus you can query Rhino and make decisions.
Here are a couple of examples of automating Rhino using vbs. The first example just launches Rhino, adds some geometry, and saves the file. The second example will render a 3dm file.