I’d like to have a Rhino command run every time Rhino starts. I know that I can manually add the command here in options:
But I want to add the startup command from a Python script (or rvb script). I am implementing this change on many users’ machines and would like to have the startup commands added or removed from a script.
I saw on the forums how to update the PackageManger source setting in python:
settings = Rhino.PlugIns.PlugIn.GetPluginSettings(Rhino.RhinoApp.CurrentRhinoId, False)
s = settings.GetChild("Options").GetChild("PackageManager")
s.SetString("Sources","https://yak.rhino3d.com;" + packageFolder)
But I cannot figure out how to adapt this code to edit the startup commands. Can anyone help?
there is a lot of info in this old topic:
Is it possible to add a rvb with rhinoscript?
Cannot get it to work if it is even possible.
I’m trying with:
Thats as far as I get.
Is it possible what I want?
Thanks for the reply - I had read through that topic before posting but unfortunately it does not answer my question.
They discuss how to make .RVB scripts run at startup but what I want to do is to script adding a command to options to run at startup.
Returns the number of startup scripts.
Return the list of startup script files.
Adds a startup script to RhinoScript.
Removes a startup script to RhinoScript.
my guess is, if you add a file with .py this will also run.
You might also workarround by calling a command of a custom (your) (rhinocommon) plug-in.
rhinoscript is directly accessing the c++ sdk methods.
phyton and rhinoscriptsyntax are based on rhinocommon.
image from here
there might be difference of what is accessible.
i never tried, but you might also be able to add a startup script using a macro.
because of this
thread i think @stevebaer might be the right person to answer your question with more details / options / alternatives.
I couldn’t get Rhino to run a py script from the startupscriptlist but thanks to your links I came up with a bit of a clunky workaround that is doing what I need.
If it helps anyone in the future: I have an .RVB script that calls the command that I want:
commandName = "GoodMorning"
I am using another RVB script to add the initial script to the startup script list, I would have preferred to do this with python but I could only access AddStartupScript through RVB:
filePath = "C:\my file\path here\WakeUp.rvb"
I can then finally call the StartupEnable script from python to add the command to the startup script list:
scriptPath = r"C:\my file\path here\StartupEnable.rvb"
Rhino.RhinoApp.RunScript("-LoadScript " + scriptPath, True)