Wednesday
Apr022003
WinAPI from LS to copy to Windows clipboard
April 2, 2003
Here is some LotusScript that uses the Windows API to copy text to the Windows clipboard (of course, the clipboard will handle pretty much anything, but this example is for text).
Before getting to the actual code, I must state that I can take no credit at all for the code in this posting; it was found here. As my buddy Scott (a.k.a. "Sparky") would say, this was all R&D ("Rob and Duplicate"). But that's the sign of an efficient developer, right?
In this case, I put the bulk of the code in a script library, put a computed field on the Notes form to hold the constructed text that the content owners needed (for pasting into some hotspot urls later), and put a simple call in a form action button to allow the user to just click a button to get the needed text. Here's the script library.
Be sure to list the script library in your form's Global Declarations:
Before getting to the actual code, I must state that I can take no credit at all for the code in this posting; it was found here. As my buddy Scott (a.k.a. "Sparky") would say, this was all R&D ("Rob and Duplicate"). But that's the sign of an efficient developer, right?
In this case, I put the bulk of the code in a script library, put a computed field on the Notes form to hold the constructed text that the content owners needed (for pasting into some hotspot urls later), and put a simple call in a form action button to allow the user to just click a button to get the needed text. Here's the script library.
Be sure to list the script library in your form's Global Declarations:
And then simply add code similar to this wherever you want to invoke the routine:Option Public
Option Explicit
Use "libWindowsClipboard"
Update: Ben Poole has a post with several tasty WinAPI tidbits. Well worth a read.Sub Click(Source As Button)
Dim varRet As Variant
Dim strText As String
strText = doc.txtLinkInfo(0)
' Call script library function to use WinAPI to copy strText to Windows clipboard
varRet = fSendToClipboard( strText )
End Sub
Reader Comments