Home Tasker Get 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 in style with crypto-currency

New to Tasker?

Tasker Quick Start – Getting started with Tasker

0
From newb to not so newbie in 10 min

Best Tasker Projects

Tasker PC control – #Tutorial 3 (Apps menu)

0
Launch apps and websites from the mobile!

Tasker PC control – #Tutorial 2 (Volume Menu)

0
If you missed the part one, I strongly recommend you to check it out. It tells you all about the framework used,...

How to control your PC like a boss – Tasker Project

0
Control PC, and other devices from a custom notification system.

Bluetooth battery monitor – monitor any Bluetooth battery with Tasker

0
Measure the battery use of Bluetooth devices

The Minimal & Elegant giveaway WINNERS

0
Picking the winners live! Livestream and making a Tasker Winners project!

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)?