Trigger definition to run on start

Hey, thanks for the help!

I am trying to trigger a definition to run at grasshoppers start. I have been looking over the forums for a bit, but I have not found anything that matches what I’m trying to do with the additional functionality in Rh6.

Idea being, someone that doesn’t use grasshopper but needs to process files can just put the definition in a folder that they want to process and then launch the definition and have it run on the files automatically.

Since Rhino 6 can launch a definition without needing an active session of Rhino, i am trying to launch the definition and have it run without any interaction. My first few attempts have been around bool toggle to true, but when the definition opens the rhino command line hangs on a command “grasshopper option (window document solver banner)” and i’m not sure how to get passed it.

is there a better way to trigger a grasshopper file to run in this way?


[Edit] - upon closer inspection, my earlier statement was not correct. a grasshopper that has a bool set to true will open and run. the problem i am actually having is the Format component does not seem operate correctly when this toggle is left true. In my case it does not merge the file name to import, it only passes the F input.

see attached test definition (47.9 KB)

I’m thinking this post could be helpful, I might just use a batch file instead. perhaps turning off the echo will suppress the command that gets stuck.

I’m trying to figure out how to use this with my current C# program that we use in the send to folder, this allows us to point at a folder to process and then open the definition and read the folder.

currently using the “Process” class in .net system.diagnostics, I will look into how to send the “echo” command as well. I will update soon.

After further investigation, I have found that my error is in the send to rhino command. I have tested an internalized list that looses the links to the files that need to be open. I tested this with a custom python comp, YK tools and lunchbox component.

New example (43.3 KB)

ok, I feel the need to apologize to anyone that comes arros this mess. …

hopefully you can find some help in my wondering, and perhaps someone will be able to add a better solution.

currently I’m implementing an expire solution on the python component to get around what i think is Rhino’s initialization. here is the code:

Import Grasshopper
def addDocEvent(sender,e):
“”" Update this GH component “”"

if sc.sticky[“expire”] < 1:

    sc.sticky["expire"] += 1
    r.RhinoApp.Initialized += addDocEvent

using scriptcontext.sticky to get around a infinite loop.

Hope it helps, or someone has a better solution