Taking a screenshot with tasker?

5,835 views
Skip to first unread message

Lex

unread,
Nov 11, 2012, 11:43:55 PM11/11/12
to tas...@googlegroups.com
I had the same problem. Before you continue, if you don't have root, I don't think it's likely that you'll get far. I ended up installing various screenshot apps and tinkering around in their directories in /data. SuperSU or Root Logger Pro will tell you what command the app is using to take a screenshot. Often they run an executable from in the app's data directory.

I found an app that takes a screenshot and saves it in png format, and I snitched the executable and put it in /data/local/bin. Then I just run it using tasker. You ought not redistribute the executable, though -- and neither should I, so I can't share mine with you. I'm pretty sure it was from the trial version of some screenshot app, though.

Good luck!

bdanders

unread,
Nov 12, 2012, 11:48:56 AM11/12/12
to tas...@googlegroups.com
Try "Run Shell": /system/bin/screencap -p %filename
Where "%filename" is a variable describing where the screenshot should be stored.

May or may not work depending on your version of Android, but it works for me on CM10.

On Sunday, November 11, 2012 12:03:39 PM UTC-5, Nabil Fahim wrote:
I've been looking for a way to take screenshots with tasker and I haven't seen a solution anywhere. Is there any way to set it up?

I'm currently looking for a way that on my Nexus S, when I long-press the search soft-key it takes a screen shot. 

Any Help anyone?

Wietse van Buitenen

unread,
Nov 12, 2012, 2:26:20 PM11/12/12
to tas...@googlegroups.com
this is quite interesting, as a loyal CM user this will come in handy :)
just tested it and it woks great!
thanks for the tip!

Andreas Ødegård

unread,
Nov 12, 2012, 2:29:37 PM11/12/12
to tas...@googlegroups.com
This is interesting to me too. Don't have CM so will prob have to find some alternative way. My tasker-based todo list system not has options for adding via voice and photo, and I was thinking just the other day that a screenshot option would be handy.Basically an always accessible feature that takes a screenshots, variable queries a title, and adds it to my todo list

Lex

unread,
Nov 12, 2012, 2:29:58 PM11/12/12
to Tasker
Ah right, forgot to mention: when I tried that in a terminal on my
cm7.1 phone, screencap never finished and I had to ctrl-c it. No idea
why.

bdanders

unread,
Nov 12, 2012, 9:22:39 PM11/12/12
to tas...@googlegroups.com
I don't this this is a CM specific feature, I think it's something that's part of Jelly Bean and maybe even Ice Cream Sandwich.

Pent

unread,
Nov 13, 2012, 2:13:57 AM11/13/12
to Tasker
Works fine on my Nexus S JB 4.1.2 (unrooted)

But will it work next Android version...

Pent

easiuser

unread,
Nov 13, 2012, 9:54:28 AM11/13/12
to tas...@googlegroups.com
I am running CM10 on an HTC Inspire and have not been able to use the power-vol down combination to get a screenshot.  Thought this might work but can't get it working.  Hope I am missing something obvious.  I get a flash indicating tasker was granted root permissions but the file is not there and A3 never gets executed.
 
ScreenShot (124)
 A1: Variable Set [ Name:%ssfile To:sdcard0/Tasker/sstest Do Maths:Off Append:Off ]
 A2: Run Shell [ Command:/system/bin/screencap -p %ssfile Timeout (Seconds):40 Use Root:On Store Result In:%returned ]
 A3: Flash [ Text:%returned Long:Off ]

bdanders

unread,
Nov 13, 2012, 10:00:20 AM11/13/12
to tas...@googlegroups.com
My guess is the formatting of your file name is off. Try another slash before the "sdcard". You might also need to specify the file extension as ".png".

Here is mine:
%filename = /sdcard/Pictures/Screenshots/Screenshot-%DATE-%TIME.png

easiuser

unread,
Nov 13, 2012, 3:12:34 PM11/13/12
to tas...@googlegroups.com
Thanks.  Had to add the first slash and change it to sdcard even though filemanager reports sdcard0.  Also have to use root or I just get a blank screen.

Pgr

unread,
Nov 14, 2012, 7:47:12 AM11/14/12
to tas...@googlegroups.com
Hi Pent.

I'm using the exact same phone and OS, but screencap doesn't work. I went into a terminal and tried it from the command-line (not root). It gives a segmentation fault. I know my path is ok because it actually creates a file, but it is zero-length. I tried with:

screencap -p /storage/sdcard0/Pictures/screen.png

What did you use to make it work?

Thanks
Pgr

Pent

unread,
Nov 14, 2012, 8:29:57 AM11/14/12
to Tasker
> screencap -p /storage/sdcard0/Pictures/screen.png
>
> What did you use to make it work?

I used path /sdcard/Tasker/test.jpg. Filename could be relevant I
guess.

Pent

Pedro Gonçalves Rodrigues

unread,
Nov 14, 2012, 9:45:04 AM11/14/12
to tas...@googlegroups.com

Funny, doesn't work for me.

I tried your path both with and without the -p switch (I think correct is without -p to get a jpg), the file appears at the correct location but is always a zero-length file...

I also tried from the terminal emulator, running the task from within Tasker, and running it from the home screen using a "Long search" keypress context. Always the same result.

Is your phone rooted?

Pent

unread,
Nov 14, 2012, 10:11:50 AM11/14/12
to Tasker
> Is your phone rooted?

No, unrooted vanilla.

Pent

Pedro Gonçalves Rodrigues

unread,
Nov 14, 2012, 10:17:14 AM11/14/12
to tas...@googlegroups.com

Then I guess we have a bit of a mystery here.

Oh well, I'll have to play with a different feature now. Btw, I'm loving Tasker, it's endlessly useful and fun!

Pgr

Pgr

unread,
Nov 15, 2012, 1:20:29 PM11/15/12
to tas...@googlegroups.com

I just discovered I can take a screenshot on my unrooted Nexus S by pressing and holding Volume-down and Power buttons at the same time.

I don't know if this is old news for the original poster and everbody else in this thread, I guess being able to take screenshots with Tasker does allow for more creative configurations, but if all you want is a screenshot... there you have it.

Pgr


moviejimmy

unread,
Nov 16, 2012, 1:40:37 AM11/16/12
to tas...@googlegroups.com
Works on my S3! Needs root to work though!

moviejimmy

unread,
Mar 6, 2013, 4:30:00 AM3/6/13
to tas...@googlegroups.com


On Monday, March 4, 2013 3:40:54 AM UTC+8, dustin dvorak wrote:
Moviejimmy, I am trying to get my s3 running cm10 to take a screen shot when I do a gesture. I have the Run Shell put in according to how people on this thread have been saying along with the file directory and can't seem to get it tow work. Any help would be appreciated. 


On Thursday, November 15, 2012 10:40:37 PM UTC-8, moviejimmy wrote:
Works on my S3! Needs root to work though!

Hi,

My Run Shell task is :

Command:
/system/bin/screencap -p /sdcard/test.png

Use Root:
Tick

Let me know if this doesn't work.
 

janvg

unread,
Jun 30, 2013, 5:49:04 PM6/30/13
to tas...@googlegroups.com
I am trying to let my S3 make a screenshot on every 4th of the month at 23.00, but can't get it to work :-(
My phone is NOT rooted so i don't know if it is even possible to make Tasker do so...

Op woensdag 6 maart 2013 10:30:00 UTC+1 schreef moviejimmy het volgende:

francwalter

unread,
Nov 5, 2013, 4:40:26 PM11/5/13
to tas...@googlegroups.com
This works on ny SGS2 with 4.1.2
I take a screenshot and name it like the system does:

TakeScreenshot (36)
A1: Variable Set [ Name:%ssfiledir To:/storage/sdcard0/Pictures/Screenshots Do Maths:Off Append:Off ]
A2: Run Shell [ Command:DATUM=`date +%Y-%m-%d-%H-%M-%S`
echo $DATUM Timeout (Seconds):5 Use Root:On Store Output In:%output Store Errors In: Store Result In: Continue Task After Error:On ]
A3: Run Shell [ Command:cd %ssfiledir
pwd
/system/bin/screencap Screenshot_%output.png Timeout (Seconds):5 Use Root:On Store Output In:%output Store Errors In:%error Store Result In:%result Continue Task After Error:On ]
A4: Popup [ Title:OK Text:Screenshot saved. Background Image: Layout:Popup Timeout (Seconds):1 Show Over Keyguard:Off ] If [ %result = 0 ]
A5: Popup [ Title:ERROR Text:There was an error!
Screenshot was NOT saved! Background Image: Layout:Popup Timeout (Seconds):3 Show Over Keyguard:Off ] If [ %result !~ 0 ]

Message has been deleted

Eesger

unread,
Nov 8, 2013, 7:22:09 AM11/8/13
to tas...@googlegroups.com
Thanks francwalter for the great step-by-step run through.
I followed it to the letter, however it did not work for me.
After some puzzling I found that I needed to change the Date Shell command to get it working.
Mine is as followed:

TakeScreenshot (36)
A1: Variable Set [ Name:%ssfiledir To:/storage/sdcard0/Pictures/Screenshots Do Maths:Off Append:Off ] 
A2: Run Shell [ Command:DATUM=$(date "+%Y-%m-%d-%H-%M-%S")
echo $DATUM Timeout (Seconds):5 Use Root:On Store Output In:%output Store Errors In: Store Result In: Continue Task After Error:On ]
A3: Run Shell [ Command:cd %ssfiledir
pwd
/system/bin/screencap Screenshot_%output.png Timeout (Seconds):5 Use Root:On Store Output In:%output Store Errors In:%error Store Result In:%result Continue Task After Error:On ] 
A4: Popup [ Title:OK Text:Screenshot saved. Background Image: Layout:Popup Timeout (Seconds):1 Show Over Keyguard:Off ] If [ %result = 0 ]
A5: Popup [ Title:ERROR Text:There was an error!
Screenshot was NOT saved! Background Image: Layout:Popup Timeout (Seconds):3 Show Over Keyguard:Off ] If [ %result !~ 0 ]

I have a Galaxy Note running CyanogenMod 10.1.3 (Android 4.2).
The only strange thing is that with A4 and A5, I don't see the text inside the Popup, but I think there's probably a setting I have set wrong.
I have exported the task so if other people want to try this, they just have to import this task :)

Greetings.
TakeScreenshot.tsk.xml

doc

unread,
Nov 8, 2013, 11:33:13 PM11/8/13
to tas...@googlegroups.com
/system/bin/screencap -p /sdcard/Pictures/Screenshots/BgScreenshots/Screenshot-%DATE-%TIME.png

Been using this to take a screenshot of my blog glucose app every night fir the past year. Works flawlessly in my rooted sgs3. I use the ruin command in Secure Settings.

Ryan Wilson

unread,
Jan 18, 2014, 9:11:34 PM1/18/14
to tas...@googlegroups.com
Anyway to change the storage to /storage/extSdCard/DCIM/Screenshots or /storage/sdcard/DCIM/Screenshots

Bob Hansen

unread,
Jan 18, 2014, 10:52:34 PM1/18/14
to tas...@googlegroups.com
Just change the path to what you want and make sure that the destination directory exists. Also, you need to check the Use Root option in the Run Shell command.

/system/bin/screencap -p /sdcard/Pictures/Screenshots/BgScreenshots/Screenshot-%DATE-%TIME.png

Jacob Johnson

unread,
Jul 25, 2014, 1:54:48 AM7/25/14
to tas...@googlegroups.com
So this is odd. I have GS3 that is rooted. I type in the right commands, (I've tried so many) I check the root box, And I use a shortcut. (I want to test it first) Anything I'm doing wrong? Nothing seems to work.

estuardo castro

unread,
Oct 20, 2014, 10:56:06 PM10/20/14
to tas...@googlegroups.com
It worked for me, thanks Eesger  :)

D

unread,
Apr 22, 2015, 5:16:04 PM4/22/15
to tas...@googlegroups.com
/system/bin/screencap -p /sdcard/Pictures/%DATE%TIME.png

run this shell
Message has been deleted

Marica Marius

unread,
Aug 7, 2017, 7:47:01 AM8/7/17
to Tasker
Hello All,

I'm using a Samsung S6 running Nougat with the last version of Tasker. 

When a "Take Screenshot" task runs, the notification bar shows an icon similar to the Google Chromecast one (attached). 

Why is that happening? 

How can I disable this notification?

Thanks,
Marica!

On Monday, November 12, 2012 at 6:43:55 AM UTC+2, Lex wrote:
I had the same problem.  Before you continue, if you don't have root, I don't think it's likely that you'll get far.  I ended up installing various screenshot apps and tinkering around in their directories in /data.  SuperSU or Root Logger Pro will tell you what command the app is using to take a screenshot.  Often they run an executable from in the app's data directory.

I found an app that takes a screenshot and saves it in png format, and I snitched the executable and put it in /data/local/bin.  Then I just run it using tasker.  You ought not redistribute the executable, though -- and neither should I, so I can't share mine with you.  I'm pretty sure it was from the trial version of some screenshot app, though.

Good luck!

Marica

unread,
Aug 7, 2017, 7:59:07 AM8/7/17
to tas...@googlegroups.com

I do have root. Is it possible that you share at least a hint about how to get to that executable?

 

Thanks.

Marica

 

 

From: tas...@googlegroups.com [mailto:tas...@googlegroups.com] On Behalf Of Marica Marius
Sent: Monday, August 7, 2017 1:47 PM
To: Tasker <tas...@googlegroups.com>
Subject: Re: Taking a screenshot with tasker?

 

Hello All,

--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/xlz975AdWdQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Marica

unread,
Aug 7, 2017, 8:41:50 AM8/7/17
to tas...@googlegroups.com

Lex,

 

Or at least let me know what causes this icon to appear.

 

Regards.

 

From: tas...@googlegroups.com [mailto:tas...@googlegroups.com] On Behalf Of Marica Marius
Sent: Monday, August 7, 2017 1:47 PM
To: Tasker <tas...@googlegroups.com>
Subject: Re: Taking a screenshot with tasker?

 

Hello All,

--

Reply all
Reply to author
Forward
0 new messages