Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
If you write some Java code then you can access the clipboard in Epic using getSystemClipboard().getContents(), but if you don't want to go that route, then here is a simple ACL function that I use to get the contents of the clipboard as a string by pasting into a temporary document and storing the resutls. It will work with content that has been copied in an external application:
function getClipboardContents() {
# This function returns the contents of the clipboard as a string.
local $doc = doc_open('',0x100);
local savedoc = current_doc($doc);
local savecaret = oid_caret()
local savepos = oid_caret_pos()
paste;
clear_mark
goto_oid( oid_null() )
mark -noinvert -noselection begin
goto_oid( oid_null(), -1 )
mark end
local s = main::selection
doc_close($doc);
goto_oid( savecaret, savepos )
current_doc(savedoc)
return s
}
Cheers,
DugaldIn Reply to John Dreystadt:
Look up the function buffer_clipboard_contents in the online help. An
even easier way to do this.
function getClipboardContents() {
# This function returns the contents of the clipboard as a string.local savecaret = oid_caret()
local savepos = oid_caret_pos()local $doc = doc_open('',0x100);
local savedoc = current_doc($doc);
paste;
clear_mark
goto_oid( oid_null() )
mark -noinvert -noselection begin
goto_oid( oid_null(), -1 )
mark end
local s = main::selection
doc_close($doc);
goto_oid( savecaret, savepos )
current_doc(savedoc)
return s
}
Cheers,
Dugald