Quantcast

Forums | MacLife

You are not logged in.

#1 2009-01-20 10:45 pm

meekismurder
Member
Registered: 2009-01-20
Posts: 2

Dashcode Javascript Copy/Paste?

Hello everybody. I've been trying to figure this out for a while. I'm writing a Dashboard Widget that I would like to have a "Paste" button that spits the contents of the clipboard into a text area. Obviously you can just hit apple-V and it works, but I'd like to have a button there too. After searching for a while, the only way I've found to do this in Javascript seem to only work in MS IE:

Code:

var pasteText = document.selection.createRange(); 
pasteText.execCommand("paste");

This gives me an "Undefined Value" error. Anyone know a way to do this that would work in Dashcode?

Last edited by meekismurder (2009-01-20 10:45 pm)

Offline

 

#2 2009-01-20 11:13 pm

Miles
Now I fight for wisdom!
Administrator
From: Michigan
Registered: 2001-07-21
Posts: 4506
Website

Re: Dashcode Javascript Copy/Paste?

Code:

document.getElementById('theArea').value = widget.system('/usr/bin/pbpaste', null).outputString

Offline

 

#3 2009-01-20 11:23 pm

meekismurder
Member
Registered: 2009-01-20
Posts: 2

Re: Dashcode Javascript Copy/Paste?

Hmm, that is giving me the following error:

Code:

Value undefined (result of expression widget.system) is not object

Offline

 

Board footer

Powered by PunBB 1.2.6
© Copyright 2002–2005 Rickard Andersson