CopyToClipboard

96 views
Skip to first unread message

Kriss

unread,
Jul 14, 2011, 7:15:21 AM7/14/11
to TiddlyWiki
It took me some effort to figure this one out, so I thought I would
share it with the world.
I wanted a way to copy data stored in a tiddler, to the clipboard.
(this is for Firefox; IE is much simpler).

First create a tiddler called CopyToClipboard. This one contains:
<html><a href="javascript:;" onclick="

netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var id='@mozilla.org/widget/clipboardhelper;1';
var
clip=Components.classes[id].getService(Components.interfaces.nsIClipboardHelper);
clip.copyString('$1');
return false;"> (c) </a></html>

Now, you can copy any string [[value]] to the clipboard by clicking
the '(c)'
when you add <<tiddler CopyToClipboard with:[["+value+"]] >> to a
tiddler.

I use the DataTiddlerPlugin for example to store passwords and serials
and the like.
In the code of the DataTiddlerPlugin-tiddler search for the part where
it defines the display of the datatable.
Search for config.macros.showData.renderDataAsTable

There replaced the line starting with text+= with this one:
text += "| "+i+"|"+value+" <<tiddler CopyToClipboard with:[["+value
+"]] >"+"> |\n";

The <<showdata>> macro will now display a '(c)' for every line of
data.

Eric Shulman

unread,
Jul 14, 2011, 7:53:43 AM7/14/11
to TiddlyWiki
> I wanted a way to copy data stored in a tiddler, to the clipboard.
> (this is for Firefox; IE is much simpler).

http://www.tiddlytools.com/#SaveToClipboard
for a cross-platform implementation of "copy(...)"

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

andrew.j.harrison84

unread,
Jul 14, 2011, 11:58:15 PM7/14/11
to tiddl...@googlegroups.com

Yes but how to copy hyperlink to clipboard? I'm using IE7.

> --
> You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
> To post to this group, send email to tiddl...@googlegroups.com.
> To unsubscribe from this group, send email to tiddlywiki+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
>

HansBKK

unread,
Jul 15, 2011, 3:28:43 AM7/15/11
to tiddl...@googlegroups.com


On Friday, July 15, 2011 10:58:15 AM UTC+7, infernoape wrote:

Yes but how to copy hyperlink to clipboard? I'm using IE7.


With any browser (in fact any application) under Windows, select the hyperlink and press Ctrl-C.

How it actually renders in your target location when you paste it (Ctrl-V) will depend on how that application handles URLs.

If I'm misunderstanding your question, please clarify with more specifics about your context.

andrew.j.harrison84

unread,
Jul 15, 2011, 8:58:05 AM7/15/11
to tiddl...@googlegroups.com

I know ctrl c ctrl v. I have need of being able to click on a link and have a hyperlink copy to the clipboard so it can be pasted. The action of selecting it in tiddlywiki is just not clean. Right now I have to select it and copy it and then paste it into Word and then reselect it and copy it again or I end up with a bunch of garbage. I use IE7.

> --
> You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/tiddlywiki/-/97p460B07ioJ.

HansBKK

unread,
Jul 15, 2011, 11:59:41 AM7/15/11
to tiddl...@googlegroups.com
On Friday, July 15, 2011 7:58:05 PM UTC+7, infernoape wrote:

I know ctrl c ctrl v. I have need of being able to click on a link and have a hyperlink copy to the clipboard so it can be pasted. The action of selecting it in tiddlywiki is just not clean. Right now I have to select it and copy it and then paste it into Word and then reselect it and copy it again or I end up with a bunch of garbage. I use IE7.


right-click-->copy shortcut

andrew.j.harrison84

unread,
Jul 18, 2011, 3:34:26 PM7/18/11
to tiddl...@googlegroups.com

Right click copy only copies the path and not the pretty link. I still can't get the monarch to assign in the clipboard without first coping to word. When you select and copy from tiddlywiki it brings with it some unwanted characters, line feeds and formatting.

> --
> You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/tiddlywiki/-/HTE0FscjqRMJ.

Kriss

unread,
Jul 19, 2011, 4:36:30 AM7/19/11
to TiddlyWiki
if you format [[value]] correctly it should be working fine. (the
full url, including the http:// ... )

as for a pretty-link (where you mask the url by displaying some
other text, right? [[text|url]] ) you would copy the entire "text|
url" combination.

as far as I know, you can only copy one string to the clipboard. so
if you want to copy "text" as well as "url" (as two separate values)
this is not going to work. Or you will need to combine both in a
single string.

On 18 jul, 21:34, "andrew.j.harrison84"
<andrew.j.harriso...@gmail.com> wrote:
> Right click copy only copies the path and not the pretty link. I still can't
> get the monarch to assign in the clipboard without first coping to word.
> When you select and copy from tiddlywiki it brings with it some unwanted
> characters, line feeds and formatting.

andrew.j.harrison84

unread,
Aug 5, 2011, 9:05:04 AM8/5/11
to tiddl...@googlegroups.com

Just so you know, right click and copy only copies the path, not the pretty link. I am still working on this. I know it is possible.

Reply all
Reply to author
Forward
0 new messages