Page 1 of 2

Livecode Enhancements pack - error after update

Posted: Fri Apr 07, 2023 8:32 pm
by tomsve
I bought the LiveCode enhancement package last November. I just now started to use it (the "magic palette"), with LC 9.6.9-rc3.

Now I tried to update it and I get this error. Any ideas on how I can solve it?

I tried to install the older one, but that didn't help - I get the same error.

Thanks and regards,
Tom

Re: Livecode Enhancements pack - error after update

Posted: Fri Apr 07, 2023 9:59 pm
by tomsve
Not ideal, but I solved it by re-install LiveCode and the enhancement package.

Re: Livecode Enhancements pack - error after update

Posted: Sat Apr 08, 2023 10:43 am
by Klaus
Did you restart LC after the installation?
That fixed it for me.

Re: Livecode Enhancements pack - error after update

Posted: Tue Apr 11, 2023 5:13 pm
by tomsve
Yes, I tried restarting it. I tried it with the v 10 DP that I have installed as well, to no avail.

Re: Livecode Enhancements pack - error after update

Posted: Sun Feb 18, 2024 7:52 pm
by mbossiere
Hi, I too bought the Enhancements Pack last fall. I am just getting around to exploring EMLParser and the only info I found on it's use is

https://livecode-lessons-copy.screenste ... -emlparser

Where can I find the full EMLParser documentation?
The full documentation is important as I need to extract the dates associated with an email? (Ditto Title, Sender, Recipient)

from the above URL I see two functions it has, emlToArray() and getFullMailContentAsHTML()
I would like to see any others associated with it and the full parameter set and explanation of these two above.

Marc Bossiere

Re: Livecode Enhancements pack - error after update

Posted: Mon Feb 19, 2024 11:32 am
by stam
If you install the external, the Dictionary will be updated with the documentation (Search for 'EML').
it's not a lot - and this is an issue for many of the externals in the 'enhancements pack', there is the absolute minimum documentation possible, and even less in the way of actual examples.

This is all there is for EMLparser, it may be what you need so do check the dictionary.
EMLparser.jpg

Re: Livecode Enhancements pack - error after update

Posted: Mon Feb 19, 2024 6:50 pm
by mbossiere
Thanks. Duh... I'm sure this was a lapse of memory on my part!
Visiting the Dictionary entry was very helpful. Still it's pretty paltry information there, I find.
Screen Shot 2024-02-19 at 10.44.03 AM.jpg
I tried

Code: Select all

   put getHeaders(field "fileurl") -- a valid pathname of an EML file
   put getHeaders(it) -- the imported text content of an EML file
and get an empty result. I tried playing with other functions of EMLParser and can't seem to get much more than the body of an EML file.
Any ideas?
I've built the test stack as per:
https://livecode-lessons-copy.screenste ... -emlparser

What I'm after, primarily, is basics like to:, from:, title:, and date/time stamps

Re: Livecode Enhancements pack - error after update

Posted: Mon Feb 19, 2024 7:26 pm
by Klaus
I can confirm that getHeaders() returns EMPTY, BUT this is becaue that function returns an ARRAY!

So this is a documentation bug! :-/
Please report this as a bug here: https://quality.livecode.com

You can extract your infos like this:

Code: Select all

...
answer file "EML"
put url("binfile:" & it) into tData
put emlToArray(tData) into tArray
put tArray["headers"] into tHArray
put tHArray["From"] into tFrom
put tHArray["To"] into tTo
## etc...
...
See attached screenshot from my debugger.

Re: Livecode Enhancements pack - error after update

Posted: Mon Feb 19, 2024 7:38 pm
by Klaus
Well, even easier :D :

Code: Select all

...
answer file "EML"
put url("binfile:" & it) into tData
put getHeaders(tData) into tHArray
put tHArray["From"] into tFrom
put tHArray["To"] into tTo
## etc...
...
See all keys of that array in my screenshot.
This is from Apple Mail, so the keys may differ on your machine.

Re: Livecode Enhancements pack - error after update

Posted: Mon Feb 19, 2024 7:49 pm
by Klaus

Re: Livecode Enhancements pack - error after update

Posted: Mon Feb 19, 2024 11:16 pm
by mbossiere
Wonderful! Thanks, Klaus. I do not understand arrays very well, but I did successfully get all the parts I needed (sort of!)

I cobbled this together from what you sent and the tutorial I was originally following:

Code: Select all

on mouseUp
   answer file "EML"
   put url("binfile:" & it) into tData
   
   local tEMLArray, tBody
   put emlToArray(url("file:" & field "fileurl")) into tEMLArray
   put getFullMailContentAsHTML(tEMLArray, false, true ) into tBody
   
   put getHeaders(tData) into tHArray
   put tHArray["From"] into tFrom
   put tHArray["To"] into tTo
   put tHArray["Subject"] into tSubj
   put tHArray["Date"] into tDate
   put tHArray["Content-Transfer-Encoding"] into tContent
   
   put tTo & CR & tFrom & CR & tSubj & CR & tDate & CR & CR & tBody
end mouseUp
Screen Shot 2024-02-19 at 3.12.17 PM.jpg
As you can see from the above (performed on a simple email), the result has all the elements I wanted (thanks to you) but I cannot seem to figure out - from the keys you posted a screenshot of - how does one get the Body of an email? I get it in HTML format but would prefer just plain text.

Re: Livecode Enhancements pack - error after update

Posted: Tue Feb 20, 2024 9:54 am
by Klaus
Bonjour Marc,

the BODY (= the content of a mail) is the first key of that array, see my screenshot:

Code: Select all

...
put emlToArray(url("file:" & field "fileurl")) into tEMLArray

## This should give you the body in plain text, don't have an example with html to test here:
put tEMLArray["content"] into tBody

## Since my test mail contained UMLAUTS, and yours will surely contain some accents etc if in french, I had to:
put textdecode(tBody,"utf8") into tBodyClean
...
Please try this and report back.

Best

Klaus

Re: Livecode Enhancements pack - error after update

Posted: Fri Feb 23, 2024 4:05 pm
by mbossiere
Hi Klaus
I'm a little confused. I am unable to get plain text with your suggested line
put textdecode(tBody,"utf8") into tBodyClean
It appears to remain the same as tBody (HTML)
Marc

Re: Livecode Enhancements pack - error after update

Posted: Fri Feb 23, 2024 4:33 pm
by Klaus
Hm, works here, but may highly depend on the mail itslef.
I just tried with some html emails and in the end some of the tEMLArray did not even contain the key -> content !? :?

Re: Livecode Enhancements pack - error after update

Posted: Fri Feb 23, 2024 4:38 pm
by Klaus
See my screenshot:
tEMLArray["parts"][2]["content"] -> the plain text body
tEMLArray["parts"][3]["content"] -> the htmltext body
??? :shock:

Not sure if this is a bug or a feature...