Unable to edit a button LiveCode 9.6.4
Posted: Wed May 03, 2023 5:26 pm
Hi,
Not sure if this is the correct forum, but I recently created button to send an email by script using:
put tsNetSmtpSync(tURL, tFrom, tRecipient, tEmailMessage, tResponseHeaders, tBytes, tSettings) into tResult
After editing the script and closing the script editor and saving the stack, I am unable to edit the button even when selecting and using the Pointer tool.
When using the Pointer tool, the button functions as if the browse tool were selected (run mode I believe its called).
I copied the script of the button and pasted to new button, same result.
I am able to edit the button with the community version of Livecode since an error is generated with the tsNetSmtpSync.
Any thoughts?
Was unable to attach the script so I pasted it as below. (except for my email credentials).
Cant even thing of anything that would cause this.
Thanks.
John Burnett
on mouseUp
local tUrl, tEmailMessage, tRecipient, tBody, tFrom, tTo, tCc, tSubject, tAttachments
local tSettings, tResult, tBytes, tResponseHeaders
answer "Send Message" && field "email_subject" with "No" or "Send"
if it is "No"
then
exit mouseUp
end if
-- Specify the e-mail server settings
put "-" into tUrl
put "-" into tSettings["username"]
put "-" into tSettings["password"]
-- Enable TLS for SMTP
put true into tSettings["use_ssl"]
-- Encode the e-mail message body
put mimeEncodeFieldAsMIMEMultipartDocument(the long id of field "email_message") into tBody
if field "attachment" is not empty
then
put field "attachemnt" into tAttachments[1]["filepath"]
end if
-- Encode the e-mail headers and body
put "DrBurnett@DrJB-MFP.online" into tFrom
put line 1 of field "eMail" into tTo
if tTo is empty
then
put line 1 of field "Phone" into tPhone
put tPhone & "@txt.att.net" into tTo
end if
put field "email_cc" into tCc
put field "email_subject" into tSubject
mimeEncodeAsMIMEEmail tBody, tFrom, tTo, tCc, tSubject, tAttachments
put it into tEmailMessage
-- Make tRecipient a list of all recipients (To and Cc)
put tTo & cr & tCc into tRecipient
-- Send the e-mail
put tsNetSmtpSync(tURL, tFrom, tRecipient, tEmailMessage, tResponseHeaders, tBytes, tSettings) into tResult
-- Check the result
if the first word of tResult is "tsneterr:" then
answer "Error" && tResult && "returned from server"
else
answer "E-mail sent"
put "" into field "attachment"
end if
put field "Last Name" into tLastName
put field "First Name" into tFirstName
put field "Chart" into tChart
put tLastName && tFirstName && tChart into tID
put tID & tTo & tSubject & the date && the time into tSendData
if field "Notifications" of card tID of stack "Patient Data" is empty
then
put tSendData into field "Notifications" of card tID of stack "Patient Data"
else
put tSendData & return before line 1 of field "Notifications" of card tID of stack "Patient Data"
end if
end mouseUp
Not sure if this is the correct forum, but I recently created button to send an email by script using:
put tsNetSmtpSync(tURL, tFrom, tRecipient, tEmailMessage, tResponseHeaders, tBytes, tSettings) into tResult
After editing the script and closing the script editor and saving the stack, I am unable to edit the button even when selecting and using the Pointer tool.
When using the Pointer tool, the button functions as if the browse tool were selected (run mode I believe its called).
I copied the script of the button and pasted to new button, same result.
I am able to edit the button with the community version of Livecode since an error is generated with the tsNetSmtpSync.
Any thoughts?
Was unable to attach the script so I pasted it as below. (except for my email credentials).
Cant even thing of anything that would cause this.
Thanks.
John Burnett
on mouseUp
local tUrl, tEmailMessage, tRecipient, tBody, tFrom, tTo, tCc, tSubject, tAttachments
local tSettings, tResult, tBytes, tResponseHeaders
answer "Send Message" && field "email_subject" with "No" or "Send"
if it is "No"
then
exit mouseUp
end if
-- Specify the e-mail server settings
put "-" into tUrl
put "-" into tSettings["username"]
put "-" into tSettings["password"]
-- Enable TLS for SMTP
put true into tSettings["use_ssl"]
-- Encode the e-mail message body
put mimeEncodeFieldAsMIMEMultipartDocument(the long id of field "email_message") into tBody
if field "attachment" is not empty
then
put field "attachemnt" into tAttachments[1]["filepath"]
end if
-- Encode the e-mail headers and body
put "DrBurnett@DrJB-MFP.online" into tFrom
put line 1 of field "eMail" into tTo
if tTo is empty
then
put line 1 of field "Phone" into tPhone
put tPhone & "@txt.att.net" into tTo
end if
put field "email_cc" into tCc
put field "email_subject" into tSubject
mimeEncodeAsMIMEEmail tBody, tFrom, tTo, tCc, tSubject, tAttachments
put it into tEmailMessage
-- Make tRecipient a list of all recipients (To and Cc)
put tTo & cr & tCc into tRecipient
-- Send the e-mail
put tsNetSmtpSync(tURL, tFrom, tRecipient, tEmailMessage, tResponseHeaders, tBytes, tSettings) into tResult
-- Check the result
if the first word of tResult is "tsneterr:" then
answer "Error" && tResult && "returned from server"
else
answer "E-mail sent"
put "" into field "attachment"
end if
put field "Last Name" into tLastName
put field "First Name" into tFirstName
put field "Chart" into tChart
put tLastName && tFirstName && tChart into tID
put tID & tTo & tSubject & the date && the time into tSendData
if field "Notifications" of card tID of stack "Patient Data" is empty
then
put tSendData into field "Notifications" of card tID of stack "Patient Data"
else
put tSendData & return before line 1 of field "Notifications" of card tID of stack "Patient Data"
end if
end mouseUp