Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

クリップボードから取得


function hello(){
var clip = Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
trans.addDataFlavor("text/unicode");
clip.getData(trans, clip.kGlobalClipboard);

var str = {};
var len = {};

trans.getTransferData("text/unicode", str, len);
str = str.value.QueryInterface(Components.interfaces.nsISupportsString);
pastetext = str.data.substring(0, len.value / 2);
alert(pastetext);
}