Notifications
Clear all

[Closed] How copy string to system's clipbard

Code below shows how to copy string into clipboard under all versions of 3D Max:

if( Copy_roll != undefined ) then -- recreate if window already existing
  	DestroyDialog Copy_roll
  
  rollout Copy_roll "Copy test"
  (
  	edittext copy_txt pos:[7,5] fieldWidth:220
  	button copy_btn "Copy to clipboard" width:220
  	
  	on copy_btn pressed do
  	(
  		ShellLaunch ((GetDir #scripts)+"\\Copy_to_clipboard.exe") ("\"" + copy_txt.text + "\"")
  	)
  )
  
  CreateDialog Copy_roll width:240

As you can see it needs external aplication to working. Download and place it into scripts directory.

2 Replies

external applications are unnecessary, you can use the .NET Clipboard class to achieve the same thing and more:

Clipboard = dotnetclass "System.Windows.Forms.Clipboard"
Clipboard.SetText "some text"
 JHN

Max2008 and up

getclipboardText()
setclipboardText <string>

-Johan