How can I lock my rvb script file?

How Can I lock my rvb script file, I want to open the script without seeing the content.

Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version Thursday, March 30, 2023 1:53:17 PM

Call Main()
Sub Main()
	Rhino.Print("Test")


End Sub

Any answer?

What do you mean? Run it without opening it? Somehow obscure other people from viewing it?

I have this script:

And I want to hide the content of it when I open it again for the other users after sharing it.

Hi @Ammar_Kayali,

the EditPythonScript dialog is to edit Python scripts so you will always see the script content when you open a script in this editor. To hide your code you can save your script as rvb file and compile it with the RhinoScriptCompiler. From the menu choose:

Tools > Script Compiler

This will create a PlugIn (rhp) and once the PlugIn has been installed it will register a new command in Rhino which you can enter into the CommandLine to run your Script.

_
c.

1 Like

Thanks @clement ,

But when I added the rvb file, I show the link,

image

How can I hide it or run it from the command immediately?

H @Ammar_Kayali, to run the script without the LoadScript dialog you can eg. make a button with this macro:

_-LoadScript “C:\Users\User\Desktop\rhinoScriptTest.rvb”

The - sign in front of the LoadScript command suppresses the dialog.

_
c.

Thanks @clement, Now I added this button :

But when I click it I get this error :
Command: _-LoadScript
Script file to load ( List ): “C:\Users\User\Desktop\rhinoScriptTest.rvb”
Cannot find script file “C:\Users\User\Desktop\rhinoScriptTest.rvb

The file exists in desktop,

And second question: the link of the script when I open the options, is visible,
but the link in the other buttons is invisible.

Right click the rvb file on the desktop and go to Properties, then a dialog pops up. Post a screenshot of this dialog please.

Sorry i am not sure what you mean. Which options ?

_
c.

I tried this link :
! _-LoadScript C:\Users\User\Desktop\rhinoScriptTest.rvb

And its worked, Thanks @clement .

Now I want to hide the link of the loading file or refuse open the edit button for the global.

You cannot hide it or lock buttons to prevent editing. Why do you want to do this ?

_
c.

Because if the user knows the link of the file, he can see my code.
I want to hide the code of the script.

Hi @Ammar_Kayali, then you can compile your Script into a PlugIn using the RhinoScript compiler. From the Rhino 7 menu choose:

Tools > Script Compiler

Once you have created the PlugIn, you can share this to other users and they can install it. The PlugIn will register a new command “rhinoScriptTest” which can be typed in the command line. Alternatively you/they can run the command from a button.

_
c.

1 Like

Thanks @clement ,

The Script Compiler is a plugin or just I can find it in Rhino 7 because I use Rhino 6?

Now I have Rhino 7 and the Script compiler option, when I clicked on it I get this window :

And it required rhc file but I have rvb file.

Yes, it is an external application which has been available since Rhino 5. Here is a long thread about it. It will also work with Rhino 6 but it was included only with Rhino 7 and 8. If you do not have it, you’ll have to download it and start the RhinoScriptCompiler.exe on your own.

Good, now you can start a new project by pressing the N key. Then add your script as a new command. You can also add information about the author etc and finally Build it, it creates a PlugIn (*.rhp) file.

Before quitting the RhinoScriptcompiler, Save your project as *.rhc file. This way you can just open your project again and do not have to enter all the data if you need to just recompile your script.

btw. @Pascal recently posted the steps to compile a Python script here, it works the same with rvb script files.

_
c.

1 Like

Thank you very much @clement