0

How can I make a "copy to clipboard" button in a dashboard widget?

An example: http://www.youtube.com/watch?v=NfdgGFrrmIQ

Frank V
  • 25,141
  • 34
  • 106
  • 144
Rafael
  • 83
  • 4
  • 10
  • Is this what you want? http://stackoverflow.com/questions/400212/how-to-copy-to-clipboard-in-javascript – Fran Verona Feb 04 '11 at 20:41
  • Fran, while there is similarity between the questions, doing this in a dashboard widget does have different challenges. So, technically the linked answer (400212) wouldn't always work. Some solutions might but I think it's a fair separate question on SO. – Frank V Jan 21 '12 at 23:32

1 Answers1

2

You can use the widget.system method.

Example: widget.system("/bin/echo '"+password+"' | /usr/bin/pbcopy", null);

For this to work, under Widget Attributes, you must enable Command Line Access (Checkbox "Allow Command Line Access"

Source: http://andrew.hedges.name/widgets/dev/ under 'System Access'

Frank V
  • 25,141
  • 34
  • 106
  • 144