mobileComposeMail, attach images [Solved]

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

mobileComposeMail, attach images [Solved]

Post by Jellobus » Fri Jul 21, 2017 10:14 pm

Hi all,

How to attach images with mobileComposeMail? I tried so many times but I couldn't make it.. I can't find what is wrong with my code..
Please help if anyone knows the solution.

Code: Select all

on mouseUp
   export snapshot from rect 0,0,100,100 of this card to url ("binfile:"&specialFolderPath("documents")&"/Pic.jpg") as JPEG
   put specialFolderPath(("documents")&"/Pic.jpg") into tAttachment["data"]
   put "image/jpg" into tAttachment["type"]
   put "myImage" into tAttachment["name"]
   mobileComposeMail ,,,,,tAttachment
end mouseUp
Thanks for your help in advance!

Louis
Last edited by Jellobus on Sat Jul 22, 2017 6:00 pm, edited 1 time in total.

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: mobileComposeMail, attach images

Post by Klaus » Sat Jul 22, 2017 12:04 am

Hi Louis,

...
## export snapshot from rect 0,0,100,100 of this card to url ("binfile:"&specialFolderPath("documents")&"/Pic.jpg") as JPEG
export snapshot from rect 0,0,100,100 of this card to FILE (specialFolderPath("documents")&"/Pic.jpg") as JPEG
...
That should do the trick. :)


Best

Klaus

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: mobileComposeMail, attach images

Post by Jellobus » Sat Jul 22, 2017 1:35 am

Hi Klaus,

it still not functional. Can it be a bug?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7229
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: mobileComposeMail, attach images

Post by jacque » Sat Jul 22, 2017 3:42 pm

The parentheses are misplaced, and this will only put the file path into the array:

put specialFolderPath(("documents")&"/Pic.jpg") into tAttachment["data"]

The data element of the array needs the actual image data, so you need to use the URL syntax:

put url ("binfile:" &
specialFolderPath("documents")&"/Pic.jpg") into tAttachment["data"]

Or you can use the file path if you put it into the "file" element of the array:

put specialFolderPath("documents")&"/Pic.jpg" into tAttachment["file"]
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Jellobus
Posts: 317
Joined: Tue Dec 10, 2013 2:53 pm

Re: mobileComposeMail, attach images

Post by Jellobus » Sat Jul 22, 2017 6:00 pm

It's working now. thanks for your advice!!

Best,

Louis

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”