Link to Ignition Project, MS Office formatted Hyperlink?


I am generating an Ignition Project Link from inside a project to allow other users to get back to a Specific Date Time. So the Ignition Project link with 3 parameters is massively long. I am hoping someone knows the underlying “Clipboard Syntax” for nicely formatted MS Office Hyperlinks(I can create a hyperlink in Word and paste into OneNote, the Display Text and Underlying Link remain across Office Applications). I am just trying to create the MS Office compatible Hyperlink from a button inside of Ignition. I can generate a Project Link, copy to Clipboard and pass in Parameters no Problem, I just want my users to be able to paste a “nice looking” link instead of my massive Project Link.

When I get home I plan to install a “Clipboard Inspector”? I should be able to figure out whats stored on clipboard as I copy a link from Word to Outlook or OneNote.

I thinking I am going to have to get involved with HTML Dataflavors.

I could manipulate clipboard with a Clipboard Viewer tool and push HTML format back to clipboard. Just need to learn about Java DataFlavors and push HTML to clipboard instead of just string data.

Without knowing too much about the office stuff, you’re probably on the right track. I believe most office stuff is wrapped up HTML/XML on the backend, so you’d just have to get it into the right format. You may be able to find someone else’s example in some other program to get the right format, but good luck (I didn’t have any).

On the dataflavor/clipboard stuff - yes, you’ll need to implement a custom class in Jython that implements the Java Transferable interface; that’s what will do the actual translation of “thing in Ignition” into “HTML on the clipboard”. I have a (somewhat overkill for your needs) example of implementing the Transferable interface here: PDF report linking

1 Like

Took a little bit of reading but I learned about DataHandler appears to implement Transferable.
I guess the “internet” is still in Ignition just need to know which Java Library to import?

def putHTMLStringToClipboard(html_str):
    from javax.activation import DataHandler
    from java.awt import Toolkit
    from import InputStream, ByteArrayInputStream
    cb = Toolkit.getDefaultToolkit().getSystemClipboard()
    ba = ByteArrayInputStream(html_str)
    dh = DataHandler(ba,"text/html")
    cb.setContents(dh, None)
putHTMLStringToClipboard('<a href="">google</a>')

original source from attempting to learn about Dataflavors and implementing Transferable
I guess this Sikuli software uses Jython as well(probably could automate testing my Ignition clients with Sikuli)

1 Like