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.
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'
in CPython3 the special None keyword can be used as attribute (or enum)
you can replace dialog.DefaultButton = TaskDialogResult.None
by dialog.DefaultButton = getattr(TaskDialogResult, "None")
then will come an overload problem, you can look at this topic for more information