Clipboard Event? i.e. Fires when clipboard contents change

1,750 views
Skip to first unread message

David

unread,
Feb 11, 2011, 6:07:15 PM2/11/11
to Tasker
Is there any way to make a task run when the clipboard's contents
change?

I want to append the clipboard's contents to a log file.

I looked around for a while and didn't find anything.


WorkArounds I did find that could work.... partially...

* Gesture could trigger appendToLogFile task - Weakness: sometimes
gestures are tricky and frustrating (maybe I'm just not good at
creating them)

* Timed Event, firing at smallest interval (2 min, I think) -
Weakness: would not capture all clipboard actions if clipboard changed
contents too rapidly.


Thanks for any help!

David

Hagure

unread,
Feb 13, 2011, 11:53:44 PM2/13/11
to Tasker
It'd be cool to do this with Tasker, but FYI, there's an app called
ClipStore that keeps a clipboard history.

Again though, I'd love to ditch YA app for a Tasker task!

fubaya

unread,
Feb 14, 2011, 2:22:46 AM2/14/11
to Tasker
Although I agree it would be better to have it in pure Tasker, that
may do what he wants. Not only does it save the history in the app,
but also in a plain text file at /data/data/jp.benishouga.clipstore/
files/clip.txt in a very simple format.

I already have some scripts to manipulate that file if I can be of any
help.

Stefan Sarzio

unread,
Feb 14, 2011, 3:17:35 AM2/14/11
to tas...@googlegroups.com
+1 for having an event. I have one or two use cases that go beyond the standard clipboard history.

Will

unread,
Feb 13, 2011, 4:40:37 PM2/13/11
to Tasker
I have not tested this, but it should work in theory. The clipboard
has to already be set to something(populated), for this to work.

Profile: Clipboard Watcher
Condition1: %CLIP != %TEMPCLIP
Condition2: %TEMPCLIP is set (this will stop this profile from running
if you have not copied anything to the clipboard yet)
Enter Task:
(Run whatever you want to run, then put this at the end)
%TEMPCLIP = %CLIP


I hope that works, there might be some lag between %CLIP changing and
Tasker noticing it.



On Feb 11, 3:07 pm, David <jamdav...@gmail.com> wrote:

Pent

unread,
Feb 14, 2011, 5:43:07 AM2/14/11
to Tasker
> Is there any way to make a task run when the clipboard's contents
> change?

Only messily: every 5 minutes:

If [ %OLDCLIP Not Match %CLIP ]
Variable Set %OLDCLIP, %CLIP
DOSOMETHING

Android doesn't have a clipboard-changed event, annoyingly.

Pent

Stefan Sarzio

unread,
Feb 14, 2011, 7:22:04 AM2/14/11
to tas...@googlegroups.com
That's strange. I wonder how these clipboard managers work. I use Clipper+ and it instantly recognizes new clippings.

Pent

unread,
Feb 14, 2011, 7:29:36 AM2/14/11
to Tasker
> That's strange. I wonder how these clipboard managers work. I use Clipper+
> and it instantly recognizes new clippings.

Must be one of those unpublished APIs.

I've only looked at the official one so far.

Pent

Hagure

unread,
Feb 14, 2011, 10:52:48 PM2/14/11
to Tasker
+1: Definitely check out fubaya's scripts; the phone clip <-> cpu clip
scripts are awesome. In fact, that's what turned me onto ClipStore to
begin with ;)

fubaya

unread,
Feb 15, 2011, 12:10:55 AM2/15/11
to Tasker
On Feb 14, 10:52 pm, Hagure <hag...@gmail.com> wrote:
> +1: Definitely check out fubaya's scripts; the phone clip <-> cpu clip
> scripts are awesome. In fact, that's what turned me onto ClipStore to
> begin with ;)
>

Thanks, I actually had to look up my ClipStore stuff because it's been
a while since I wrote it. And you know what, I found an error in my
blog post. The sed command was supposed to be 's/<n>/\n/g;q' but the
blog ate the <n> tag and turned it into 's//\n/g;q'. Oops, that error
has been there since last May. http://a-more-common-hades.blogspot.com/2010/05/paste-in-android-terminal.html

I'm assuming the phone clip <-> cpu clip you're talking about is the
Tasker setup? I did the same with ClipStore at first, then Tasker came
around and made it soooo much better.
http://forum.xda-developers.com/showpost.php?p=8446531&postcount=224

Hagure

unread,
Feb 15, 2011, 6:18:23 AM2/15/11
to Tasker
Ah yeah, I use the newer tasker/shell versions with pbpaste/pbcopy on
the mac. But I kept ClipStore around because it's such a cute (and
useful) little utility

On Feb 14, 9:10 pm, fubaya <jdm...@gmail.com> wrote:
> On Feb 14, 10:52 pm, Hagure <hag...@gmail.com> wrote:
>
> > +1: Definitely check out fubaya's scripts; the phone clip <-> cpu clip
> > scripts are awesome. In fact, that's what turned me onto ClipStore to
> > begin with ;)
>
> Thanks, I actually had to look up my ClipStore stuff because it's been
> a while since I wrote it. And you know what, I found an error in my
> blog post. The sed command was supposed to be 's/<n>/\n/g;q' but the
> blog ate the <n> tag and turned it into 's//\n/g;q'. Oops, that error
> has been there since last May.http://a-more-common-hades.blogspot.com/2010/05/paste-in-android-term...

David

unread,
Feb 22, 2011, 4:56:08 PM2/22/11
to Tasker
I just installed ClipStore. It looks, from the configuration
settings, that it's just governed by a very short timer. Now that
I've learned the trick of calling tasks multiple times with Waits in
between, I could configure Tasker to do the same thing...

Context: 2 min Timer
_ checkClipboard
_ Wait 15 sec
_ checkClipboard
_ Wait 15 sec
_ checkClipboard
_ Wait 15 sec
_ checkClipboard
_ Wait 15 sec
(continue till you get to 2 mins. Of course, one could also use a
counter and the Goto action.)

Talma

unread,
Jan 24, 2013, 6:38:01 AM1/24/13
to tas...@googlegroups.com
Any news with this question of clipboard change event?

The best solution remains the loop?

David Gardner

unread,
Jan 24, 2013, 8:19:07 AM1/24/13
to tas...@googlegroups.com
No news that I'm aware of.

BossMan

unread,
Jan 24, 2013, 8:49:03 AM1/24/13
to tas...@googlegroups.com
Actually, looks like something has changed, since 2011:

Pent, have a look at this (it is 3.0+ feature):

A.

Pent

unread,
Jan 25, 2013, 2:46:05 AM1/25/13
to Tasker
> Pent, have a look at this (it is 3.0+ feature):http://developer.android.com/reference/android/content/ClipboardManag...

Yes, I'm aware of that, it was just too time-consuming to implement
via reflection. But now that we're on API 14....

Pent

netizen

unread,
Feb 14, 2013, 10:37:35 AM2/14/13
to tas...@googlegroups.com
I'd also love to see this implemented. It would be nice to maintain both, a Tasker internal variable, and the Variable Set Event.

Paul Hedderly

unread,
May 24, 2014, 4:44:30 AM5/24/14
to tas...@googlegroups.com
I don't think this has been implemented yet - is it likely? clipboard events with autoremote would be rather nice...

Pent

unread,
May 24, 2014, 6:47:41 AM5/24/14
to tas...@googlegroups.com
%CLIP is dynamic, you can use it with e.g. Variable Set event.

Pent

Oscar Chu

unread,
Jan 22, 2015, 1:37:12 PM1/22/15
to tas...@googlegroups.com
What Pent said works great.

To get tasker to run a task when the clipboard gets updated (set), just do the following:
Create A Profile -> Add Event->Variable Set->%CLIP

Matthew Gardner

unread,
Feb 21, 2015, 11:08:28 AM2/21/15
to tas...@googlegroups.com
Any reason this wouldn't work for me? I can't get the event to trigger when I copy links to clipboard :(

Marta Hintz

unread,
Feb 21, 2015, 12:07:12 PM2/21/15
to tas...@googlegroups.com
Not sure what your doing, but I think there are some good tutorials from Ryoen or Hoolywoodfrodo that go over it.

Ryoen Deprouw

unread,
Feb 22, 2015, 7:40:34 AM2/22/15
to tas...@googlegroups.com
I created it my own Clipboard manager... See post on my Google+: https://plus.google.com/116748651052467942212/posts/WeY5jeiQbYR
Monitor your clipboard, and just work with an array... Its quite easy...

Op zaterdag 12 februari 2011 00:07:15 UTC+1 schreef David:
Reply all
Reply to author
Forward
0 new messages