Using BAT file to install a list of plugins for users

Hey guys I am trying to set up a batch file that would automatically install the plugins for new users.

"C:\Program Files\Rhino 7\System\Rhino.exe" /runscript="-RunPythonScript "C:\myscript\mycript.py"

Inside the python script

import rhinoscriptsyntax as rs
objPlugIn = rs.PlugIns(types=0, status=0)

if not ("PluginABC" in objPlugIn):
     "install PluginABC from Path"

However I don’t find any Install Plugin from Path Methods in the Rhino Common API.

Really appreciate if you can help me on this.

Hi @Wiley,

Does this help?

import Rhino

dict = Rhino.PlugIns.PlugIn.GetInstalledPlugIns()
for item in dict:
    path = Rhino.PlugIns.PlugIn.PathFromId(item.Key)
    print('Id = {0}'.format(item.Key))
    print('  Name = {0}'.format(item.Value))
    print('  Path = {0}'.format(path))

– Dale

Hi Dale.
Thanks for the reply.
What if the Plugins are Not isntalled?

PathFromId() method only works if the plugin is preinstalled, as far as I understand.

I edited the question a bit because I might be being confusing putting the print inside the if statement.

What does this mean?

Rhino can only report on plug-in that are registered or “installed.”

Or am I confused?

– Dale

Wiley,

Apparently the installation of a plug-in requires more information than Rhino has access to. Are you actually trying to install plug-ins for the first time or are you wanting to load them into Rhino and enable them for use during a session?

In File->Properties->Plugins on my system I see:

This shows the status of my installed plug-ins. Some are loaded, some are not. All of them are enabled. I believe when a plugin is used then it will automatically be loaded.

Which steps of the installed, loaded, enabled are you trying to script?

Regards,
Terry.

You may be successful with the Rhino.PlugIns.PlugIn.Load(string path, out Guid id) static method.

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_PlugIns_PlugIn_LoadPlugIn_2.htm

1 Like