Wrap a Python Script?

Hello,

is it possible to encapsulate a script, to be able to pass it easily to other people, without them having access to the code?
and is it possible to load python at when rhino opened? because for the first launch of a python script, there is always a few time off…

I think you can create a plug-in (.rhp) although I don’t remember where the instructions are… It used to be a bit complicated. An experienced programmer could still decompile the code and see what you programmed IIRC, but the average user not.

I made the small script below, then created an alias to its location (I called it “LoadPython”). Then I put the alias in the “Commands to run on startup” section in Options>General. That speeds up the first run a lot, there is still a tiny hesitation, but not much.

LoadPython.py (142 Bytes)

hello!!!

how can you put a script in an allias?

it’s ok… i wrote:

! _-RunPythonScript “LoadPython.py”

in the “Commands to run on startup” section in Options>General

There are a number of ways - here is a Wiki page that explains things in detail:

The short way is to save the script somewhere on your hard drive and then get the full path (including file name and extension) to the script file. Then in Options>Aliases, create your alias as follows:

_NoEcho ! _-RunPythonScript "full path to script"

So, for example if your script is named “MyNewScript.py” and it is stored on your desktop, the path would be:

"C:\Users\yourusername\Desktop\MyNewScript.py"

Yep, that’s fine, as long as you have already set a path in the script editor and the script “LoadPython.py” is stored in that folder path.