HomeTaskerGet the last picture/screenshot - Tasker Profile

Get the last picture/screenshot – Tasker Profile

Fetch one or more pictures from your phone

In a previous tutorial, I talked about setting an active PC using a combination of Tasker and EventGhost. Today I will show you the steps needed to get the last picture/screenshot from the mobile. In a similar fashion, you can download any other file, or create an array for notifications.  The results will be delivered to the active PC set by the EventGhost.

Get the last picture/screenshot – Tasker Profile

The Profile is not very complicated. Tasker looks for the last picture or a screenshot that has been taken by us and pushes it via Join to a correct machine.

A single file

PROFILE - Fetch Picture
Profile: Fetch Picture 
	Event: AutoVoice Recognized [ Configuration:Command:
               "get the last (?<dir>picture|screenshot) (regex)" ] 
        Enter: Get Picture

AutoVoice Command Recognised

You can use other triggers if you wish. I used the AutoVoice in the video to get the pictures sent over to the computer.  For this method, you will need regex groups, something I have talked in detail before. The capturing group %dir  contains picture|screenshot value that is used to determine the correct folder with media. I used the ‘get the last (?<dir>picture|screenshot)‘ as my filter.

Get the last picture/screenshot – task

Load the file names and sort it by the date (reversed) to an array (%file). The directory depends on the value of %dir variable from the AutoVoice trigger. I’m using List files action for that.

The selected file is used in a Join Push action. I mentioned before that I named my devices according to the names from Join. This saves me time as I can use the variable %ActivePC as the device name in push action (see advanced options).

TASK - Get Picture
Get Picture 
	A1: List Files [ Dir:DCIM/Camera Match: Include Hidden Files:Off
            Use Root:Off Sort Select:Modification Date, Reverse Variable:%file ]
            If [ %dir ~ picture ]
	A2: List Files [ Dir:Pictures/Screenshots Match: Include Hidden Files:Off
            Use Root:Off Sort Select:Modification Date, Reverse Variable:%file ]
            If [ %dir ~ screenshot ]
	
	A3: Join Send Push [ Configuration:Files: %file1
Device Name: %ActivePC Timeout (Seconds):60 ]

Multiple files

What if you want to send last 2 or more pictures/screenshots? That’s not a problem either. We will have to repeat the same action X times for each file that we want to push to the computer.

Intercept a number of screenshots/pictures from a trigger. I suggest using another voice command to make it easier. Once you have the number of files needed and assigned to a variable %nofiles, you are ready to go. Use the regex group to capture the value and save it as a correct variable. I have used the TEST A1,A2 to set these.

TASK -Get Pictures
Get Pictures (32)
	TEST A1: Variable Set [ Name:%nofiles To:3 Recurse Variables:Off Do Maths:Off Append:Off ] 
	TEST A2: Variable Set [ Name:%dir To:picture Recurse Variables:Off Do Maths:Off Append:Off ] 
	A3: Variable Set [ Name:%count To:1 Recurse Variables:Off Do Maths:Off Append:Off ] 
	A4: List Files [ Dir:DCIM/Camera Match: Include Hidden Files:Off
            Use Root:Off Sort Select:Modification Date, Reverse Variable:%file ]
            If [ %dir ~ picture ]
	A5: List Files [ Dir:Pictures/Screenshots Match: Include Hidden Files:Off
            Use Root:Off Sort Select:Modification Date, Reverse Variable:%file ] 
            If [ %dir ~ screenshot ]
	
	A6: Array Pop [ Variable Array:%file Position:1 To Var:%filetosend ] 
	A7: Join Send Push [ Configuration:Files: %filetosend
Device Name: %ActivePC Timeout (Seconds):60 ] 
	A8: Variable Add [ Name:%count Value:1 Wrap Around:0 ] 
	A9: Goto [ Type:Action Label Number:1 Label:Loop ] 
            If [ %count < %nofiles | %count eq %nofiles ]

Loop A6

First, assign a value 1 to %count variable, and place it as the 1st action. Array Pop action will assign the 1st position from the array to a variable %filetosend (update the Join Push). This action will also shuffle the elements up. Label this action as ‘Loop‘.

A7

Follow this with a Join Push action with a modified file option.

A8

Increase the value of the %count variable by 1.

A9

Keep looping with Go To (label: Loop)action until the value of %count <= %nofiles. This will send a number of files assigned to the %nofiles variable.

Other uses

In a similar manner, you can send any other files, notifications, messages etc. As long as they are stored in an array. The great thing about it is the %ActivePC variable that assures the info is going to be shared with one PC only.

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

New to Tasker?

Tasker Quick Start – Getting started with Tasker

0
From newb to not so newbie in 10 min

Best Tasker Projects

How to use Raspberry PI as WOL (wake on lan) server

0
While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

How to wake on LAN computers and put it to sleep with Power Menu,...

0
How to Wake on LAN properly via Android, Alexa, Google Assistant and Web

7 awesome Bluetooth keyboard shortcuts for Android

0
7 unique Android shortcuts that you can add to any Bluetooth keyboard.

Smart overnight charging with Tasker

0
Still keeping your phone plugged in overnight? Try smarter overnight charging with this profile

One thing that Join app can’t do and how to fix it with Tasker

0
It's not possible to share the clipboard automatically between join accounts registered to 2 different emails. But you can fix this with tasker.

Essential Guides

Tasker: Seconds into DD:HH:MM:SS (dynamic)

0
It's time to.... ok it's a pun, but I will show you how to master time and convert seconds to DD:HH:MM:SS dynamically

4 ways to organise Tasker projects

0
Keep your Tasker tidy!

A better way to store Tasker credentials

0
The more clever way of managing credentials

Annoyed with dozens of AutoApps populating your app drawer? Here is a fix!

0
Clear your app drawer from the clutter in seconds

Putting AutoTools pie chart to a good use – SSID logger

0
Who wants a piece of the pie (chart)?