Grasshopper button to launch grasshopper script

Hey guys,

I made a UI in grasshopper that holds some buttons. I want these buttons to each run their own different grasshopper script.

Whats the best way of achieving this?

Kind regards,

Niels

You probably need to specify what is meant by “launch” and “run”. For instance, one can open/close Grasshopper definitions pretty trivially with a scripting component:

Yeah, i need my button in grasshoper, to load/open a grasshopper script from my harddrive.

the script doesnt seem to be working for me

How so? Again, being as specific as possible helps.

I have no experience with python at all so i don’t know what it does.

This is my node setup. All I want is for that button to run a grasshopper file.
Click button 1, run file 1
Click button 2, run file 2

edit: the script from your video is in the python script

Try downloading the files instead of recreating them:

That said, it looks like you just needed to rename your component input parameters. Assuming the code inside is correct.

You mean the X and Y of the python script?

but, what does this script do exactly?

Correct, those names becomes variable names inside the script. So your error is likely “Open does not exist”.

The first one gets the Grasshopper plugin and calls a method for opening a Grasshopper document:


231026_OpenDocument_00.gh (3.3 KB)

The second does the same thing, but closes the active document instead:


231026_CloseDocument_00.gh (2.0 KB)

But again, you can download the files attached here and you should be good :slight_smile:

This makes alot more sense! Thank you :). ill try it asap

1 Like