Start dynamo script from excel

Now we’re getting somewhere. Thanks everybody !!

The issue I encountered with the passthrough is that it seems to let the data pass as soon as the “wait for” function has ran, whatever the result is. I thought that at least with a popup, there would be no issue of that kind

Yes, I did it that way too, but it let my data (a string for the file path) pass in all cases (even with a null value as a result in the function that is to wait for).

I might be getting confused at this point, but wouldn’t an If node be more effective than a Wait or PassThrough? Doesn’t Wait just look for any value to continue? Wouldn’t it make more sense to use If to look for a specific output/toggle?

This seems to work really simply indeed :slight_smile:

I guess my question is are you trying to avoid interaction with Dynamo or any interaction at all? You could have an If node check the value of a specific cell so it would automatically continue once you say you’re finished. Still requires an input, but it’s all in Excel.

Haha I would hope not. Would be really cool if we could get this working without any manual confirmation.

1 Like

The idea is to avoid interaction with dynamo until input in excel is finished.
Just an idea…It’s maybe more easy to check if excel is still active. If active do not update, if closed open the file and read date from the excel file

To make it somewhat easier to follow, I will share what I did: I Read from File the sheet 3 that is currently empty, and the If node check this with == to let the file path string pass or not to another Read from File node that reads the final data I want to update

1 Like

That was a thought I had as well, but it’s all way beyond my knowledge of Python. You’d probably need to access the Excel API.

hahaha…same thing here. Have a nice weekend !
We’ll figure it out soon.

1 Like

Have you tried using the bumblebee package? This should be easy to do with it. You can read and write to an actively open workbook and all you’d have to do is toggle a bool node and re-run the graph.

I have tried with ReadExcel.ByRange and could not make it work, but Read Excel would work indeed. I still believe that a popup to click on when you are done with the edition of the spreadsheet in Excel would be efficient and simple, because the graph is then frozen until you click. This popup could maybe return the needed boolean value :slightly_smiling_face:

Try this in a codeblock:
List.Count({Passthrough})>List.Count({waitfor})?
Passthrough:
Passthrough;

Ah, I thought it was a different issue. Good script now that I understand the use. Out of curiosity, what happens if a user gets stuck mid-excel update?

Also you may want to consider a different name - DanEDU.WaitForExternalUpdate as one idea. Calling it DanEDU.WaitFor is what lead me to ask “Why is there some much effort here when one code block will make it work as it?”

Test on my side wasn’t successful: the data still pass through, even if the result of the function to wait for is null, but I assume this is not the way intended to use this node. It would be nice to see an example.
To all useful ends, this followed the post I mentioned earlier:

Just to mention it also, AutoHotkey, that was mentioned in the post below, can apparently also create scripts which can be used to launch programs, open documents, etc.

Another one that could be useful:

And here is how to control Dynamo from the command line which let “control and automate the running of Dynamo graphs”:

Simply closing the Excel spreadsheet would be an interaction anyway and could reveal itself to be quickly ennoying. But I am totally convinced there could still be lots of good things to do with Excel, especially because of the possible interaction with Python. My intent was only to try to sum up the existing possibilities before the development of a new one :grinning:

I’ve created a small Python script that might be what I’m looking for.
Strange thing is that it works fine when I open Excel manually and let the script run.
When I open an Excel file with a python script and then let it continue to my Wait for Excel script it doens’t seem to work.Test - 11.dyn (1.9 KB)

That sounds so wrong it might be right…

Who wants to experiment with a series of time consuming nodes like list.permutations, a Python script to write the time the Python node receives input, and a wait for node to cause the sequence to run in and out of order?

Your goal is to do an asynchronous operation:

  1. pause the main thread execution
  2. create a new thread that raises an event to check if a certain field in the active excel workbook has been populated
  3. get an answer and process it
  4. If false, continue stalling the main thread and raise a new event. Else if true, merge the worker thread and continue the main execution.

Technically it might be possible to do this through a python script but I don’t really see the benefit of doing so and putting so much effort into it for something this simple.

1 Like