Calling ctypes to create a custom system message

Background: I’ve got a script that takes awhile to run, so I’d like to append a node at the end of the script which will cause a system window to pop up over whatever other windows I’ve got open so I know that it’s done.

I can use Iron Python to run this code:

which get the results I want:

But when I run the same code in Dynamo:

I get this error message:

So my question: Why can I call ctypes in Iron Python but not inside dynamo? Do I need to import another library or change the formatting?

1 Like

Dynamo does not include the default python/ironpython library into the script context (path)
Just add it yourself:

import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import ctypes

I wish the dynamo team would include it by default, this question comes up very often

PS: not sure why you need ctypes, but if you only need it to create alerts/msg boxes, you are could always just use the default revit ui elements:


import clr
from Autodesk.Revit.UI import TaskDialog

TaskDialog.Show('Title', 'Message')

With Options

(python translated from

import clr
from Autodesk.Revit.UI import TaskDialog, TaskDialogCommonButtons, TaskDialogResult, TaskDialogCommandLinkId

mainDialog = TaskDialog("Hello, Revit!")
mainDialog.MainInstruction = "Hello, Revit!"
mainDialog.MainContent = """This sample shows how to use a Revit task dialog to communicate with the user. The command links below open additional task dialogs with more information."""

mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "View information about the Revit installation")
mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "View information about the active document")

mainDialog.CommonButtons = TaskDialogCommonButtons.Close;
mainDialog.DefaultButton = TaskDialogResult.Close;

mainDialog.FooterText = "Click here for the Revit API Developer Center"

tResult = mainDialog.Show()
OUT = tResult


Ah! Thanks! I knew it was an import issue!

My intent is to to call on a system message so I know not only when the script has completed when dynamo (sometimes running in sandbox mode) is running behind other windows.


Hi @JacobSmall,

I would like to show a system message only when my graph has fully completed. Is their a method for that? Or a line that should be added to the above python script?


Best to start a new topic, but if your python has an input, it will not trigger until the input is fed in. As such, if you collect all the branches of your graph into a single list, and then use that list to trigger the python node.

1 Like

Hi guys,
this link doesn’t work:

Can you please update it?
Would help alot!
Thanks :slight_smile:

Try here for more info.