Remembering inputs outside of Dynamo Player

Hey there is a script I was able to create last year. It’s been really helpful and now I am trying to integrate it into our pyRevit toolbar.

However I was hesistant because I did not have a reliable way to store the last chosen configurations of the slider. I thought that if I write to a textfile and read from it the next time it runs it will just be able to set the sliders correctly

However there is an issue with the data-shapes node. I think there is an issue with the Element Binding of the textfile path or something. But I really don’t have an idea how to store and overwrite values in a way that this works. Anyone here have any idea?

If you’re using pyRevit, you should be able to store and select inputs from the user’s config:

I missread, probably not very useful if all you’re doing is launching the graph from pyrevit.

1 Like

Yeah exactly, I just want to read values from a textfile. But I think there is a loop logic or dependency somewhere that prevents this loop from working properly.

I assume you’re talking about the If node which seems to take default values or an input from the text file. The text file is exactly that - text. When reading from the file, you’re providing string values instead of numbers for the number slider. You just need to convert the strings back to numbers.

1 Like

Or use an alternative format which maintains the data type, such as JSON, XML, or the like.

1 Like

This did it!! I wasn’t even thinking in that angle at all. Glad it was an easy fix. Nice to know I that I can now expand the toolbar and just save stuff to textfiles to remember inputs; adding more skills to my Dynamo belt

Would the Write to and Read from file nodes handle this correctly?

Yes; in the case of JSON quite well.

StringifyJson and ParseJSON are built just for this. XML and other formats can manage this quite well too, but you might need to write your own encoder/decoder in some cases.