Python command help please!

Hi there,

I have come across this python script to run a Array Between command, it is a py file. Could anyone please give me some steps on how I can make this a command that I can shortcut, or type in the name of to run please?
I am using mac and rhino 8.


follow the windows instructions - rhino 8 on Mac behaves more or less like this. (EDIT: regarding toolbar / button editing)
You can use _macroEditor to test if the script is found / if your macro is correct:

! _-RunPythonScript "<full path to your script including extension>"

then copy the working macro from the macroeditor to an alias or button.

Hmm, does that mean the info on the wiki page for how to set up Python scripts to run on Mac needs to be modified for V8?

Thank you!
So I have set up a macro ,its working to run the python script, I added this as a button and into a new custom toolbar, as well as an alias.
However If I type in the actual name of the command in the command bar, which is ‘Array Between’ it doesn’t find it, is there a way to set that also? Or did I go wrong somewhere ?

Also apologies my laptop is logged into a different account for some reason

A couple of things perhaps… First, you cannot have spaces in command names. Thus you cannot have an alias or command that is Array Between (with a space between array and between). It could however be ArrayBetween.

Second when you create an alias to run a script, the alias name IS the command. The actual name of the script file or any of the subroutines in it don’t matter at all.

Looking at the macro it’s just the name of the macro set to Array Between with a space so I don’t think that will affect it here.
My alias is set to AB, which works nice as a shortcut. But like on other commands as you start typing the name of them in the search it brings up the results of commands.

A space is interpreted as Enter in a macro as well, unless the entire thing is enclosed in quotes.

If AB is an alias for another command, when you type it, it will not autocomplete to the command it is calling. However, if you type just ‘a’, you should see ‘ab’ in the autocomplete list with all the other commands that start with ‘a’. I.e. any alias names you have are included in the autocomplete suggestion list.

If you want your command to be called ArrayBetween, then use that for the alias instead of AB (you could even have both that call the same script if you want). That way if you type ‘arr’ for example, you will get all the array commands showing up in the autocomplete suggestions, including ArrayBetween.

1 Like

Ahhh I see, I now have made two separate aliases one is AB, and the other ArrayBetween, both with the same script command to run, and seems to work as I intended now with both options to run!
I guess my confusion was thinking aliases were just a shortcut to a command, and creating a new command was something else

Just realised, this is what I meant about actually making a command, a bit more complex but seems to have worked: Rhino - Creating Rhino Commands Using Python