# How to take an input into a Ctype

**URL:** <https://forum.dynamobim.com/t/how-to-take-an-input-into-a-ctype/24617>\
**Category:** Uncategorized\
**Created:** [August 8, 2018, 8:14pm UTC](https://forum.dynamobim.com/t/how-to-take-an-input-into-a-ctype/24617 "2018-08-08T20:14:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 8, 2018, 8:14pm UTC](https://forum.dynamobim.com/t/how-to-take-an-input-into-a-ctype/24617/1 "2018-08-08T20:14:28Z")

</div>

Hello,  
I was looking at this forum post here:

> [@Calling ctypes to create a custom system message](https://forum.dynamobim.com/t/calling-ctypes-to-create-a-custom-system-message/9357):
>
> 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: [image] So my question: Why can I call ctypes in Iron Python but not inside dynamo? Do I need to import anoth…

And I would like to make a CType window that pops up at the end of my script run just like this post wants. However, I want it to include data from my script to tell the user a specific number. However I dont know how to do that. My Python skills are extremely limited but I would like to figure this out. Besides that I am already using data shapes at the begining of the script so therefore I cant use them at the end. Please let me know what I need to do. Here is what I have so far:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/5/c522421ac59fd19abe09373ec6dc17a9fdca79d2.png)

---

<div class="post-metadata">

**Author:** ![Ewan\_Opie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ewan_opie/32/77070_2.png) [@Ewan\_Opie](https://forum.dynamobim.com/u/Ewan_Opie)\
**Post date:** [August 8, 2018, 9:02pm UTC](https://forum.dynamobim.com/t/how-to-take-an-input-into-a-ctype/24617/2 "2018-08-08T21:02:56Z")

</div>

You need to import some extras from the RevitAPIUI before this will work.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/d/cda571a503fc11b43742639fc765ac19feb37a93.png)

```
import clr

clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *

dataEnteringNode = IN[0]

b = TaskDialogCommonButtons.Ok

TaskDialog.Show('Title',dataEnteringNode,b)

OUT = "You just displayed " + dataEnteringNode

```

But there shouldnt be any reason to not use the Datashapes UI again.  
You will just need to enforce the run order of the Graph so the last input waits before promptin with the UI.

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [August 8, 2018, 9:05pm UTC](https://forum.dynamobim.com/t/how-to-take-an-input-into-a-ctype/24617/3 "2018-08-08T21:05:18Z")

</div>

For example like this :

```
import clr
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
TaskDialog

TaskDialog.Show("FYI",IN[0])

```

![Taskdialog](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/5/8537c2af6f96035930610f3156324d79c3096b46.jpeg)

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 9, 2018, 2:12pm UTC](https://forum.dynamobim.com/t/how-to-take-an-input-into-a-ctype/24617/4 "2018-08-09T14:12:09Z")

</div>

Thanks Ewan! So what does the b=TaskDialogCommonButtons.Ok line do? I dont see any reason for it. Likewise, the TaskDialog.Show(‘Title’, dataEnteringnode,b) makes sense right up until ‘b’. Because it doesnt show anything for ‘b’. So what is that for? I dont understand. Sorry I am just trying to learn. Alban’s makes a lot more sense to me, but I figure there has to be some reason for your extra code. What is it? Thanks!

---

<div class="post-metadata">

**Author:** ![mix](https://avatars.discourse-cdn.com/v4/letter/m/919ad9/32.png) [@mix](https://forum.dynamobim.com/u/mix)\
**Post date:** [August 9, 2018, 2:17pm UTC](https://forum.dynamobim.com/t/how-to-take-an-input-into-a-ctype/24617/5 "2018-08-09T14:17:07Z")

</div>

also,  
Is there a way to take information from users like this below, i cant seem to figure out how to set info in these buttons or extract it once its clicked on. Any more info on this node would be most helpful!

import clr  
clr.AddReference(‘RevitAPIUI’)  
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

---

<div class="post-metadata">

**Author:** ![Ewan\_Opie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ewan_opie/32/77070_2.png) [@Ewan\_Opie](https://forum.dynamobim.com/u/Ewan_Opie)\
**Post date:** [August 9, 2018, 9:20pm UTC](https://forum.dynamobim.com/t/how-to-take-an-input-into-a-ctype/24617/6 "2018-08-09T21:20:33Z")

</div>

> [@mix](#):
>
> So what is that for?

This is the value I used to define a CommonButton for the dialogue.

> [@mix](#):
>
> but I figure there has to be some reason for your extra code

You can have multiple buttons in your dialogues to be able to influence the progression of your workflow.  
Here is how this can be used. 😀

```
import clr
clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import *

dataEnteringNode = IN[0]

buttonlist = TaskDialogCommonButtons.None|TaskDialogCommonButtons.Ok|TaskDialogCommonButtons.Yes|TaskDialogCommonButtons.No|TaskDialogCommonButtons.Cancel|TaskDialogCommonButtons.Retry|TaskDialogCommonButtons.Close

result=TaskDialog.Show("Title",dataEnteringNode,buttonlist)

OUT = result

```

![ezgif-4-89d37b5ae4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/0/b00fb7582d767391623b8c22ba13d0c3f9a31c79.gif)
