Page 1 of 1
mobileComposeMail
Posted: Tue Feb 19, 2013 8:46 pm
by KennyR
Ok...I'm getting tired of asking questions, but this has me baffled... This statement used to work, but for some reason now it won't. I am simply passing a field into a variable (that was declared on the card), and placing it in the mobileComposeMail command. I have two other variables that work just fine, but for some reason, the "To" field of the email will not fill with the variable.... any thoughts on what I am doing wrong?
Code: Select all
local vWork
put "someEmail@yahoo.com" into vWork
on mouseUp
put vCrew & cr & cr & "Currently Stocked Items" & cr & fld "iot" card "Send" & cr & cr & "Items Needing Re-stocked" & cr & fld "not" card "Send" into vBody
mobileComposeMail vRig && vShift,vWork,,,, tAttachment
end mouseUp
Re: mobileComposeMail
Posted: Tue Feb 19, 2013 9:11 pm
by Klaus
Maybe this will work if you add an OF?
... fld "iot" OF card "Send" & cr & cr & "Items Needing Re-stocked" & cr & fld "not" OF card "Send"
Re: mobileComposeMail
Posted: Tue Feb 19, 2013 9:18 pm
by KennyR
Hi Klaus....everything in that string works fine with the exception of the variable "vWork" ....For some reason the variable will not populate the "To" line of the email....Which is weird, because my other variables work just fine.....it's just that one.....
Re: mobileComposeMail
Posted: Tue Feb 19, 2013 9:48 pm
by bn
Hi Kenny,
you can not "put something into somethingElse" outside a handler. A handler starts with on and ends with end.
Code: Select all
local vWork
on mouseUp
put "someEmail@yahoo.com" into vWork
put vCrew & cr & cr & "Currently Stocked Items" & cr & fld "iot" card "Send" & cr & cr & "Items Needing Re-stocked" & cr & fld "not" card "Send" into vBody
mobileComposeMail vRig && vShift,vWork,,,, tAttachment
end mouseUp
will work.
You can initialize a script local variable, the one you declare at the top of the script, in your case vWork.
Code: Select all
local vWork = "someEmail@yahoo.com"
on mouseUp
put vCrew & cr & cr & "Currently Stocked Items" & cr & fld "iot" card "Send" & cr & cr & "Items Needing Re-stocked" & cr & fld "not" card "Send" into vBody
mobileComposeMail vRig && vShift,vWork,,,, tAttachment
end mouseUp
that would also work.
But no conditionals when initializing a script local variable, no code.
A script local variable is only seen by the script where it is declared. If you want to initialize vWork from a different script you could use a custom property or a global variable. (I tend to avoid global variables)
Kind regards
Bernd
Re: mobileComposeMail
Posted: Tue Feb 19, 2013 11:31 pm
by KennyR
Thanks for the reply.....Putting that outside the handler was my mistake when I drafted my question....I do know you can't do that outside a handler....I just screwed up!

I am still having issues getting the variable vWork to pass into the mobileComposeMail line....all my other variables are taking just fine, its just the one that handles the "to sender" line of the script. I've attached my script to give a better idea of what is happening..
Code: Select all
local vWork
on touchEnd pld
mobGUIUntouch the long id of me
/*if vAirway is not 0
then
answer "Airway supplies missing from inventory. Please go back and complete Airway section"
exit touchEnd
end if
if vWhite is not 0
then
answer vWhite
answer "ALS supplies missing from inventory. Please go back and complete ALS section"
exit touchEnd
end if
if vTS is not 0
then
answer vTS
answer "Trauma Supplies missing from inventory. Please go back and complete Trauma section"
exit touchEnd
end if
if vMisc is not 0
then
answer "Miscellaneous Supplies missing from inventory. Please go back and complete Miscellaneous section"
exit touchEnd
end if*/
put "someEmail@yahoo.com" into vWork
put vCrew & cr & cr & "Currently Stocked Items" & cr & fld "iot" card "Send" & cr & cr & "Items Needing Re-stocked" & cr & fld "not" card "Send" into vBody
mobileComposeMail vRig && vShift, vWork,,vBody
end touchEnd
Re: mobileComposeMail
Posted: Tue Feb 19, 2013 11:37 pm
by Simon
Hi Kenny,
What happens with this:
Code: Select all
on mouseUp
mobileComposeMail "Hi There", "someone@yahoo.com",,"Things I want to say"
end mouseUp
If that works then slowly add your variables back in 1 by 1.
Simon
EDIT: This may be a dumb thing to ask but do you know about "breakpoint" or when you click on the line number in the script editor you get a red dot? This allows you to step through your code and watch your variables.
EDIT 2: Oh DOH! THis is in the sim

Re: mobileComposeMail
Posted: Tue Feb 19, 2013 11:47 pm
by KennyR
Hey Simon! I owe you a beer or two!!!
To answer your question, if I put "
someEmail@yahoo.com" it works fine....its only when I attempt to pass a variable in that position of the line....the other variables work well...as far as the breakpoints...yes I do, but with the mobileComposeMail line, it will only work in the simulator not in the IDE....

Re: mobileComposeMail
Posted: Wed Feb 20, 2013 12:35 am
by Simon
Hi Kenny,
only when I attempt to pass a variable in that position
That is just not right, I'll build a test stack and see if should be reported as a bug.
On another subject:
You should post to this blog with a pic of your app (looks great) and a description of your work as a paramedic and why you built the app.
http://forums.runrev.com/phpBB2/viewtop ... hilit=1001
Simon
Re: mobileComposeMail
Posted: Wed Feb 20, 2013 1:22 am
by Simon
Nope sorry, I can't reproduce this as a bug.
Code: Select all
on mouseUp
put "Test E-mail" into tSub
put "someEmail@yahoo.com" into tRes
put "This is the e-mail body text" into tBod
mobileComposeMail tSub, tRes,,, tBod
end mouseUp
Works fine... Maybe it's the var vWork? Could it be a property of mobGui? Or used elsewhere in your stack?
Oh well, it's something.
Simon
Re: mobileComposeMail
Posted: Wed Feb 20, 2013 1:27 am
by KennyR
OMG! This actually worked this time....Maybe you are right, maybe it just didn't like my var....but I tried other combinations of the var and nothing....I'm convinced that liveCode is mad at me or something....Thanks for building and testing this for me....Oh btw...I checked out that blog and am going to make an entry....I very much appreciate your comments and help buddy....
Re: mobileComposeMail
Posted: Thu Feb 21, 2013 3:02 am
by KennyR
Simon, or anybody for that matter... :0
I still believe there is a problem passing data into the "To" position of the mobileComposeMail command....If you do this...
on mouseUp
put "
SomeEmail@yahoo.com" into tMail
mobileComposeMail tSub,tMail,,,tBod
end mouseUp
The result is you get the "To" portion of the email populated with the local var tMail, but if you do this....
on mouseUp
put fld "someField" of group "someGroup" into tMail
mobileComposeEmail tSub,tMail,,,tBod
end mouseUp
you get nothing.....I have even answered the tMail prior to firing off the mobileComposeMail command just to see if the variable is holding data....(and it is)
Could you or someone please verify that I am not crazy? Create a field, make a button and script it just like I have and tell me the results....cause it ain't working for me!
** and yes, I am declaring the variables outside the handler everywhere I use tMail...just fyi
Thanks!!
Re: mobileComposeMail
Posted: Thu Feb 21, 2013 3:19 am
by Simon
OK just checked it.
It does work but it looks like there is email address validation.
Things like it must have an "@" in it and .com/.net/.org etc.
If it doesn't comply the To: fld will end up empty.
Simon
Re: mobileComposeMail
Posted: Thu Feb 21, 2013 3:23 am
by KennyR
WOW....you are quick....Thanks my man! I'm trying it now.....
EDIT .....You are right as always sir....thanks buddy