Adding URL or Hyperlink in a forms.alert() TaskDialog

Is it possible to have a clickable URL/Hyperlink in the form?

Hello, Hi, What’s up? Welcome,

_ general bienséance rule _

from pyrevit import forms

forms.alert(msg='With the forms alert, the link is expressed in html in the sub_msg argument ', sub_msg="<a href=\" \">Click here for the pyRevit Forum</a>")

and another way directly from the TaskDialog class of the Revit API

MainContent => sub_msg argument in the forms module

The code below demonstrate also the usage of the CommandLink and the result upon clicking to opens a webpage.

import webbrowser
from Autodesk.Revit.UI import (TaskDialog, TaskDialogCommonButtons, TaskDialogCommandLinkId, TaskDialogResult)

title = 'Task Dialog Title'
dialog = TaskDialog(title)
dialog.MainContent = "<a href=\"\">Click here for the pyRevit Forum</a>"
dialog.CommonButtons = TaskDialogCommonButtons.Ok
# Add Command Link
                      'Click here for',
                      'Command Button Sub Text')

result = dialog.Show()
if result == TaskDialogResult.Ok:'')
if result == TaskDialogResult.CommandLink1:'')
1 Like

Thank you that is exactly what I was looking for… much appreciated


1 Like