I am using the following code, by Eric, to copy a string to the clipboard.  
I call " gdeSaveToClipboard(...)" shown below, with the appropriate 
argument, to copy a string to the clipboard.

If I called this function multiple times within the tiddler, it only copies 
the string passed to the last call and ignores the rest.

Is there a way to make this work for copying multiple strings to the 
clipboard?  For example, right now, I am using it for copying the name of 
the tiddler created to the clipboard.  I would like to copy the name of the 
tiddler as well as the time it was created separately to the clipboard.  

(In case you wonder, I have freeware utility called "Ditto" that let me 
access multiple items from the clipboard on Windows.)

Thank you for your help.

Cheers; 'best,
shankar swamy


function gdeSaveToClipboard(textToCopy) {
    function copy(out) {
                //alert("Copied: " + textToCopy);
        if(window.Components) { // FIREFOX
            
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
            var id='@mozilla.org/widget/clipboardhelper;1';
            var 
clip=Components.classes[id].getService(Components.interfaces.nsIClipboardHelper);
            clip.copyString(out);
        } else if(window.clipboardData) { // IE
            window.clipboardData.setData('text',out);
        } else if(document.execCommand) { // CHROME, SAFARI, IE6
            var ta=document.createElement('textarea');
            ta.style.position='absolute';
            ta.style.left='-100%';
            document.body.appendChild(ta);
            ta.value=out; ta.select();
            document.execCommand('Copy',false,null);
            document.body.removeChild(ta);
        } else throw('cannot access clipboard');
    }
    
    try     { copy(textToCopy); }
    catch(e) { // FALLBACK
        alert('Copy to clipboard() failed - please copy the text 
manually.');
        }
}

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/tiddlywikidev/-/FImlH-dZnBMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywikidev?hl=en.

Reply via email to