Page 1 of 1

mobileComposeMail, attach images [Solved]

Posted: Fri Jul 21, 2017 10:14 pm
by Jellobus
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

Re: mobileComposeMail, attach images

Posted: Sat Jul 22, 2017 12:04 am
by Klaus
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

Re: mobileComposeMail, attach images

Posted: Sat Jul 22, 2017 1:35 am
by Jellobus
Hi Klaus,

it still not functional. Can it be a bug?

Re: mobileComposeMail, attach images

Posted: Sat Jul 22, 2017 3:42 pm
by jacque
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"]

Re: mobileComposeMail, attach images

Posted: Sat Jul 22, 2017 6:00 pm
by Jellobus
It's working now. thanks for your advice!!

Best,

Louis