How do I add a link to a pop-up?

Reading through this: Calling ctypes to create a custom system message - #2 by Gui_Talarico

But can’t work out how to :
1 : add a link from my server (not URL) to the CommandLinks
2: add an e-mail link or to the footer text
3: add hyperlink (a URL) to the command links.

In a Python window in Dynamo

Anyone know?

Hello @Alien

here an example

import clr
import sys
import System
clr.AddReference("System.Windows.Forms")
from System.Windows.Forms import Clipboard
# import Revit API
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitAPIUI")
from Autodesk.Revit.UI import (TaskDialog, TaskDialogCommonButtons,
                               TaskDialogCommandLinkId, TaskDialogResult)
myForum = 'https://forum.dynamobim.com/'
myMail = 'MyNameIsNobody@nowhere.com'
title = 'Task Dialog Title'
dialog = TaskDialog(title)

# Properties
dialog.MainInstruction = 'Text Header'
dialog.MainContent = 'Text Content'
dialog.FooterText = 'Footer Text'
dialog.VerificationText = 'Verification Text'
# dialog.ExpandedContent = expanded_content

# Settings
dialog.TitleAutoPrefix = False
dialog.AllowCancellation = True
# Add Button
dialog.CommonButtons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Yes
# Set Default Button
dialog.DefaultButton = TaskDialogResult.None
# Add Command Link
dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1,
                      'Go to my favorite forum',
                      myForum)
dialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2,
                      'Copy my email in the Clipboard',
                      myMail)

result = dialog.Show()

if result == TaskDialogResult.Ok:
	OUT ='Dialog was OK'
if result == TaskDialogResult.Yes:
	OUT = 'Dialog was Yes'
if result == TaskDialogResult.Cancel:
	OUT = 'Dialog was Cancelled'
if result == TaskDialogResult.CommandLink1:
	System.Diagnostics.Process.Start(myForum)
	OUT = myForum
if result == TaskDialogResult.CommandLink2:
	Clipboard.SetText(myMail)
	OUT = myMail
if dialog.WasVerificationChecked():
	OUT = 'Verification was Checked'
2 Likes

You could also check out the Data-Shapes package.

I love datashapes but unless I’ve missed that node I’m not sure you can just have a pop-up with a URL?

Thank you for that :slight_smile:

Do you know how to make it link to non-URL… for example to

“C:\Users\Default\Pictures” ?

try this
System.Diagnostics.Process.Start(r'C:\Users\Default\Pictures')

4 Likes