Run at project start by user choice (run, don´t run, never run)

Hello pyRevit Friends :slight_smile:

I have a hook script that loads a bunch of families into the project, creates some types for System families, etc.

Now I want to give the user the ability to decide if he wants to run this script, don´t run the script or never run the script. So i pretty much want to build something like this window we all know:

This should be user specific and project specific. So my code has to remember if a user already used it once in this project or if he clicked on “never run”, so it won´t run (again).

My only idea to do this is to write to a csv file and later read it to get my desired information. The only problem i see is that project names may not be unique…

Is there any other method for my task? Happy about any advice :slight_smile:

kind regards!

Check the taskdialog class in the Revit API.
Or the alert method in the forms module of pyrevit.

For the storage of user choice, i prefer using the script module with the get_config and set_config methods that do store data in the pyrevitconfig.ini file.
There are a few example of this in the repo

1 Like

Hello @Jean-Marc,

Ok, get_config and set_config is what I was looking for!

So this is also what is used in the pyRevit tools that allow to make adjustments, for example the match tool?!

I thought this might be a setting for the current session only…

here´s the mentioned link:

Will read up on userconfig, thanks for your help @Jean-Marc .:slight_smile:

For the storage of the project specific information, my preferred method is using extensible storage within the document itself. That way you don’t need to worry about unique identifiers within an external storage document. However, it is significantly more complex to get going than userconfig.


Thank you @BlakeN

Again I’m amazed how big the revit universe is and how little i know.

No problem - let me know if you do choose to pursue extensible storage for your idea. Specifically, I use it to dump a json array into a string field within a datastorage element as suggested by thumDer

Just to be totally clear, this is shines for storing data that you want centrally accessible to all users within a given project, not a user specific setting.

I had to fumble around interpreting articles with C# examples for a while before I got a grasp of it, i’d be happy to share some python code snippets if it makes your life easier.