How exactly does %FOTO work?

837 views
Skip to first unread message

Ian Strascina

unread,
Dec 28, 2013, 12:53:42 PM12/28/13
to tas...@googlegroups.com

I want to write a task that emails me a photo (using SL4A script sendemailA.py) as soon as I take it.  Docs say that %FOTO is "The filesystem path to the last photo taken by Tasker or the standard system camera application."  However, if I do something as simple as a Flash alert to show %FOTO, it just shows the text "%FOTO", not the path to the file.

My system camera save photos to my SD card at /mnt/sdcard/ext_sd/DCIM/100MEDIA/.  Even if I change the alert to show /mnt/sdcard/ext_sd/DCIM/100MEDIA/%FOTO, it still just display the text verbatim.

The emailing works fine if I hard code an actual photo( /mnt/sdcard/ext_sd/DCIM/100MEDIA/whatever.jpg), so I know the email config isn't the problem.  I just don't know how to access the most recent photo, and the docs aren't much help.  How am I supposed to do this?

Bonus:  Does %FOTO also work for videos recorded from the camera, or is it strictly images?

CazMaz

unread,
Dec 28, 2013, 2:09:58 PM12/28/13
to tas...@googlegroups.com
Hi Ian,

%FOTO is a variable that is set when you use the Tasker "Take Photo" task to take a picture. It's the last photo taken. Use the "Take Photo" task as a step to set up the naming convention, delay time and so forth of the image. The system camera does not set or use the %FOTO variable in any way that I know of, you must use Tasker.

+, media, take photo
then, you can setup the camera and photo taking process, file naming convention, whether or not to use the gallery, etc.

Hope this helps,
Mark

Ian Strascina

unread,
Dec 28, 2013, 7:17:57 PM12/28/13
to tas...@googlegroups.com
Well, as I posted directly from the documentation, %FOTO is "The filesystem path to the last photo taken by Tasker or the standard system camera application".  So I expect that the system camera can interact with that variable.  If it truly doesn't, they need to change the wording in the documentation, because that's very misleading.

I suppose I can always try to find the most recent file in the directory instead, but I was hoping it would be simple and straightforward.

nanobrain

unread,
Dec 28, 2013, 7:58:57 PM12/28/13
to tas...@googlegroups.com
It shows the last photo taken with my system camera app on my phone which is a Nexus 5 running stock 4.4.2. I would assume that it is highly dependent on the phone/ROM you are using. You could try another camera app and hope that it will do whatever the system camera app is supposed to be doing. 

Stathis Efstathiou

unread,
Dec 29, 2013, 2:37:40 AM12/29/13
to tas...@googlegroups.com
I just did a test now on my HTC One X and it shows correctly the path. I tried with stock sense camera and facebook camera. Both paths showed correctly

Pent

unread,
Dec 29, 2013, 3:53:47 AM12/29/13
to tas...@googlegroups.com

My system camera save photos to my SD card at /mnt/sdcard/ext_sd/DCIM/100MEDIA/.  Even if I change the alert to show /mnt/sdcard/ext_sd/DCIM/100MEDIA/%FOTO, it still just display the text verbatim.

Tasker looks in sdroot/DCIM in order to set %FOTO to a value. Probably your ROM is reporting your sdroot as being somewhere else.
Unfortunately Android only officially supports one 'external storage' directory.

I guess you have a Samsung.

Pent

Pent

unread,
Dec 29, 2013, 4:05:31 AM12/29/13
to tas...@googlegroups.com
I'll arrange to check common alternative sdroots for next version.

Pent

Pent

unread,
Dec 29, 2013, 4:39:50 AM12/29/13
to tas...@googlegroups.com

I'll arrange to check common alternative sdroots for next version.

Oops. A problem with that is that %FOTO returns the API-reported-storage-relative dir like

DCIM/Camera/bob.jpg

If it finds it in a non-API-reported-storage dir, then anywhere you use %FOTO in Tasker, it's not
going to find the file because relative dirs are assumed to be relative to the API-reported storage
dir i.e. you would have to prefix what you know to be the external root to %FOTO to use it.

I think that would cause a lot of confusion, so I'm going to leave it as is for now.
When Google get round to implementing an API for multiple external storage locations,
I'll revisit this.

Pent

Ian Strascina

unread,
Dec 29, 2013, 8:21:04 PM12/29/13
to tas...@googlegroups.com
No, I have an HTC Incredible 4G.  I have my stock Sense camera app saving to my actual SD card (/mnt/sdcard/ext_sd) instead of the "internal storage" (/mnt/sdcard).

Pent

unread,
Dec 30, 2013, 3:26:39 AM12/30/13
to tas...@googlegroups.com

No, I have an HTC Incredible 4G.  I have my stock Sense camera app saving to my actual SD card (/mnt/sdcard/ext_sd) instead of the "internal storage" (/mnt/sdcard).

That's the problem then.

I'm sure they have their reasons, but I can't fathom why the manufacturers chose to put their internal
storage at a path which previously had been used by all devices for external storage (/mnt/sdcard)
and then have Android return that value when the app asks 'where is external storage ?' Even though
it's internal storage.

Pent

Pent

unread,
Dec 30, 2013, 3:27:53 AM12/30/13
to tas...@googlegroups.com
p.s. a workaround should be to use a File Changed event on the directory where fotos are saved, then
do List Files and get the most recent file by testing each with Misc / Test (File Modification Date)

Pent

Ian Strascina

unread,
Jan 1, 2014, 9:59:16 PM1/1/14
to tas...@googlegroups.com

Meh, I ended up using SL4A and just writing my own python script.

Pent

unread,
Jan 2, 2014, 3:45:43 AM1/2/14
to tas...@googlegroups.com


Meh, I ended up using SL4A and just writing my own python script.


It only takes an event with a 3 action task, but OK.

Pent
Reply all
Reply to author
Forward
0 new messages