Page 1 of 1

Question about variable's use

Posted: 11 Jan 2015 03:40
by ltplenus
Hello all,

I understand the concept of a variable 100% though im not really able to utilize it in my flows. I dont know where to define them and how to properly structure them ( im lacking a better explanation, sorry...)

As an example, im trying to send a picture taken with the camera as a SMS message however, im not able to populate the Body the way it should be. Any help is appreciated ;-)

Re: Question about variable's use

Posted: 12 Jan 2015 19:53
by Martin
Hi,

Automagic can only send regular text SMS with action Send SMS. It's not possible to send an MMS or any other kind of instant message (Whatsapp, Threema etc.) that contains an image.
However you could attach the picture to a mail and send the mail with Automagic.

Something like this should work:
-trigger ...
-action Take Picture: /storage/emulated/0/picture.jpg (No user interface)
-action Mail with Gmail and set Files to Attach to {picture_path}

The action Take Picture stores the image to the external storage of your device and provides a variable called picture_path that contains the path to the picture. The expression {picture_path} in the mail action will be replaced by the actual path of the picture when the flow is executed.

Regards,
Martin

Re: Question about variable's use

Posted: 12 Jan 2015 23:20
by ltplenus
Thanks for your response Martin,

I was actually aware of the other possibility. I have actually built something similar to what you said ( Shortcut - Take Picture - Mail with Gmail ) and a ''Cerberus like'' Wrong Login Code with picture using the same principals...
But now, your comment brought something up to my mind..
What if i wanted to take picture after picture and have it sent without deleting the original/previous file ( picture.jpg, picture1.jpg, picture2.jpg and so on ) ??

Thanks again !

Re: Question about variable's use

Posted: 13 Jan 2015 20:37
by Martin
In this case I would recommend to use the date and time as part of the picture file name (for example picture_20140113_093020.jpg). A flow like this should work:
-trigger ...
-action Take Picture: /storage/emulated/0/picture_{triggertime,dateformat,yyyyMMdd_HHmmss}.jpg (No user interface)
-action Mail with Gmail and set Files to Attach to {picture_path}

You could also use a global variable that's incremented by one each time a picture is taken.

Regards,
Martin

Re: Question about variable's use

Posted: 14 Jan 2015 18:04
by ltplenus
Thanks a lot Martin !