Script that runs another script

Hi all! I tell you the situation I want to solve:

I’ve made a macro in Excel that writes a script for Rhino into a .txt file. Now I need to make a script in Rhino that ask you where is located the .txt file, open it, and read the script inside the .txt file and run it. Is this posible to do? If it is, how could I do it? I mean, wich commands should I use in order to make a script that runs the script inside the .txt file? Thank you a lot.


you could try using the command

depending on how your .txt is written, it will run a macro in rhino from a .txt via another program

Thank you Jeff

I’ve used the “Rhino.OpenFileName” and “Rhino.ReadTextFile” commands. The first open a window where you can select the file with the script (now my script is written into a .rvb text file). The second command is supposed to read the content of this file and to store it. But I still don’t know how could I run the script that I have selected. Do anyone knows it? Thank you a lot

hmm. did you try the command I suggested?

it sounds like you’re trying to script a custom command that’s already been written for you and included in default rhino.

I tried the command you told me but it doesn’t recognize it as a command (my versión is Rhino 5). What I would like to do is to make a script that runs other script for rhino that has been previously wroten by a macro of Excel into a .rvb text file, it’s a bit difficult for me to explain it because English is not my mother language ha ha

Can you post your .txt file here so we can see whats inside it?
Or a part of it?

For example what works. Put this on your C drive
line.txt (19 Bytes)

Then copy paste this in Rhino:
-_ReadCommandFile C:\Line.txt _Enter

Then a line is drawn.

Thank you jordy, it works, but only if I write it into the command window of Rhino. The thing is that I would like to make the same thing in a script, I mean, writting it into the script editor of Rhino

Option Explicit

Call Main()
Sub Main()

    rhino.command "-_ReadCommandFile C:\Line.txt _Enter"
End Sub

[quote=“Charly, post:6, topic:28332, full:true”]
I tried the command you told me but it doesn’t recognize it as a command (my versión is Rhino 5).[/quote]
ReadCommandFile is a rhino5 command.

are you using an English version of rhino?

yeah, i understand what you’re trying to do… i’ve done the same thing before:
Poor man's scripting

(after that little excursion, i would now say to use python instead… definitely :wink: )

Thank you a lot Jeff and Jordy, now it works. I’m a beginer in this world so I’m a bit ignorant ha ha ha Thank you very much!!