Writing to a Text file then email the file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Writing to a Text file then email the file
I am trying to write to a text file and then email that file.
Here is some representative code
put " " & fld "lftp1" of card 3 & fld"tspr1"of card 3 & fld "totalproceeds" of card 3 into line 43 of URL (specialfolderpath("documents") & "/sellnet.txt")
close file URL (specialfolderpath("documents") & "/sellnet.txt")
put file URL(specialfolderpath("documents") & "/sellnet.txt") into tattachment
go card 4
mobilecomposemail "Net Sheet", "tom@jatyindustries.com", , ,"Please see the attched File", attachment
I don't know if the file is created or not but I do know that it is not being sent.
This is a standalone app on android.
Thanks for your help.
Tom
Here is some representative code
put " " & fld "lftp1" of card 3 & fld"tspr1"of card 3 & fld "totalproceeds" of card 3 into line 43 of URL (specialfolderpath("documents") & "/sellnet.txt")
close file URL (specialfolderpath("documents") & "/sellnet.txt")
put file URL(specialfolderpath("documents") & "/sellnet.txt") into tattachment
go card 4
mobilecomposemail "Net Sheet", "tom@jatyindustries.com", , ,"Please see the attched File", attachment
I don't know if the file is created or not but I do know that it is not being sent.
This is a standalone app on android.
Thanks for your help.
Tom
Re: Writing to a Text file then email the file
Hi Tom,
almost
...
## Save some typing and put path to file into a variable first:
put specialfolderpath("documents") & "/sellnet.txt" into tFile
## I hope you have a good reason for "put ... into line 43 of ...)
put (" " & fld "lftp1" of card 3 & fld "tspr1" of card 3 & fld "totalproceeds" of card 3) into line 43 of URL("file:" & tFile)
## Only close if you previously OPENed the file!
## This is not neccessary with the URL syntax!
## close file URL (specialfolderpath("documents") & "/sellnet.txt")
put URL("file:" & tFile) into tAttachment
go card 4
mobilecomposemail "Net Sheet", "tom@jatyindustries.com", , ,"Please see the attched File", Attachment
...
Best
Klaus
almost

...
## Save some typing and put path to file into a variable first:
put specialfolderpath("documents") & "/sellnet.txt" into tFile
## I hope you have a good reason for "put ... into line 43 of ...)

put (" " & fld "lftp1" of card 3 & fld "tspr1" of card 3 & fld "totalproceeds" of card 3) into line 43 of URL("file:" & tFile)
## Only close if you previously OPENed the file!
## This is not neccessary with the URL syntax!
## close file URL (specialfolderpath("documents") & "/sellnet.txt")
put URL("file:" & tFile) into tAttachment
go card 4
mobilecomposemail "Net Sheet", "tom@jatyindustries.com", , ,"Please see the attched File", Attachment
...
Best
Klaus
Re: Writing to a Text file then email the file
Hi KlausKlaus wrote:Hi Tom,
almost![]()
...
## Save some typing and put path to file into a variable first:
put specialfolderpath("documents") & "/sellnet.txt" into tFile
## I hope you have a good reason for "put ... into line 43 of ...)![]()
put (" " & fld "lftp1" of card 3 & fld "tspr1" of card 3 & fld "totalproceeds" of card 3) into line 43 of URL("file:" & tFile)
## Only close if you previously OPENed the file!
## This is not neccessary with the URL syntax!
## close file URL (specialfolderpath("documents") & "/sellnet.txt")
put URL("file:" & tFile) into tAttachment
go card 4
mobilecomposemail "Net Sheet", "tom@jatyindustries.com", , ,"Please see the attched File", Attachment
...
Best
Klaus
I am putting text into the file 1 line at a time to get it formatted correctly.
My example only showed the last line.
I'll give this a try. I thought I was close but....
Tom
Re: Writing to a Text file then email the file
Klaus,
I'm not quite sure why but the attachment isn't in the email. Everything else works.
I checked to make sure the sellnet.txt file exists by:
answer (specialfolderpath("documents") & "/sellnet.txt")
and the path shows up.
Yet no attachment.
Ideas?
Tom
I'm not quite sure why but the attachment isn't in the email. Everything else works.
I checked to make sure the sellnet.txt file exists by:
answer (specialfolderpath("documents") & "/sellnet.txt")
and the path shows up.
Yet no attachment.
Ideas?
Tom
Re: Writing to a Text file then email the file
That will just answer what you literally told it to, it's not checking to see if the file exists.
If there is a file (thepath) then... Is the form you need to test for a file's existence.
I imagine the file is there regardless. Check the line where the mobilecomposemail statement resides. I think there is a typo in the snippet from Klaus. Attachment should be tAttachment shouldn't it?
If there is a file (thepath) then... Is the form you need to test for a file's existence.
I imagine the file is there regardless. Check the line where the mobilecomposemail statement resides. I think there is a typo in the snippet from Klaus. Attachment should be tAttachment shouldn't it?
Re: Writing to a Text file then email the file
Yes I corrected the typo, But it still doesn't work.SparkOut wrote:That will just answer what you literally told it to, it's not checking to see if the file exists.
If there is a file (thepath) then... Is the form you need to test for a file's existence.
I imagine the file is there regardless. Check the line where the mobilecomposemail statement resides. I think there is a typo in the snippet from Klaus. Attachment should be tAttachment shouldn't it?
I tried the:
if there is a file (tfile) then answer tfile
else
endif
And the file shows up
and I tried
if there is a file (tfile) then answer tfile
else
endif
and the file shows up.
Still no email attachment
Thanks,
Tom
Re: Writing to a Text file then email the file
Hi Tom,
Haven't checked out your code but only gMail currently works with attachments, there is a bug report.
I tested with images and attachments do work with Android gMail.
Simon
Haven't checked out your code but only gMail currently works with attachments, there is a bug report.
I tested with images and attachments do work with Android gMail.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Writing to a Text file then email the file
Thanks Simon.Simon wrote:Hi Tom,
Haven't checked out your code but only gMail currently works with attachments, there is a bug report.
I tested with images and attachments do work with Android gMail.
Simon
That explains a lot.
Re: Writing to a Text file then email the file
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Writing to a Text file then email the file
Hi Tom,
I don't know if you already have but can you add your notes/experience/device/email client or really just anything to the bug report.
http://quality.runrev.com/show_bug.cgi?id=11895
They are looking into this right now and the more information we can provide the faster they'll find a solution.
Yeah, if it were iPhone they'd already have a solution
Simon
I don't know if you already have but can you add your notes/experience/device/email client or really just anything to the bug report.
http://quality.runrev.com/show_bug.cgi?id=11895
They are looking into this right now and the more information we can provide the faster they'll find a solution.
Yeah, if it were iPhone they'd already have a solution

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!