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 the 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

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 ]

get the last pictureLoad 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).

Multiple files

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 ]

get the last pictureWhat 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.

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.

SHARE