Copy To and From Clipboard

The following methods allow the copying of text and bitmap values to and from the Windows Clipboard.

These methods are available in 3ds Max 2008 and higher.

They were previously available in the Avguard Extensions.

   

getclipboardText()
setclipboardText <string>

Get/Set the text string in Window's clipboard. getclipboardText() returns a string value, or undefined if the clipboard does not contain a string. setclipboardText() returns true if the string was successfully placed in the clipboard, an integer error code if failed. Error code meanings are:

-1:memory could not be allocated

-2:clipboard could not be opened

-3:clipboard could not be cleared

-4:clipboard could not be set

   

setclipboardBitmap <bitmap>
getclipboardBitmap()

Get/Set the bitmap in Window's clipboard. getclipboardBitmap() returns a bitmap value, or undefined if the clipboard does not contain a bitmap. setclipboardBitmap() returns true if the bitmap was successfully placed in the clipboard, an integer error code if failed. Error code meanings are:

-1:memory could not be allocated

-2:clipboard could not be opened

-3:clipboard could not be cleared

-4:clipboard could not be set

EXAMPLE

(
local str = "Sorry For The Inconveniences!"
retCode = setclipboardText str
format "Return Code: %\n" retCode
local result = getclipboardText()
if (result != str) then
throw "Clipboard functions didn't work"
else 
format "%\n" result
 
local bm1 = bitmap 100 100 color:red
retCode = setclipboardBitmap bm1
format "Return Code: %\n" retCode
local bm2 = getclipboardBitmap()
display bm2
OK
)

See Also