Livecode Enhancements pack - error after update

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

tomsve
Posts: 45
Joined: Tue Jan 20, 2015 5:01 pm
Location: Ukraine/Armenia

Livecode Enhancements pack - error after update

Post by tomsve » Fri Apr 07, 2023 8:32 pm

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
Attachments
Screenshot 2023-04-07 at 21.21.48.png

tomsve
Posts: 45
Joined: Tue Jan 20, 2015 5:01 pm
Location: Ukraine/Armenia

Re: Livecode Enhancements pack - error after update

Post by tomsve » Fri Apr 07, 2023 9:59 pm

Not ideal, but I solved it by re-install LiveCode and the enhancement package.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Livecode Enhancements pack - error after update

Post by Klaus » Sat Apr 08, 2023 10:43 am

Did you restart LC after the installation?
That fixed it for me.

tomsve
Posts: 45
Joined: Tue Jan 20, 2015 5:01 pm
Location: Ukraine/Armenia

Re: Livecode Enhancements pack - error after update

Post by tomsve » Tue Apr 11, 2023 5:13 pm

Yes, I tried restarting it. I tried it with the v 10 DP that I have installed as well, to no avail.

mbossiere
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 44
Joined: Wed Aug 01, 2007 2:15 am
Location: Tucson Arizona US

Re: Livecode Enhancements pack - error after update

Post by mbossiere » Sun Feb 18, 2024 7:52 pm

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
“You do what you do out of your own private passion for the thing itself”
A Dillard (source: https://educheer.com/essays/annie-dillard-s-handed-my-own-life/)

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Livecode Enhancements pack - error after update

Post by stam » Mon Feb 19, 2024 11:32 am

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

mbossiere
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 44
Joined: Wed Aug 01, 2007 2:15 am
Location: Tucson Arizona US

Re: Livecode Enhancements pack - error after update

Post by mbossiere » Mon Feb 19, 2024 6:50 pm

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
“You do what you do out of your own private passion for the thing itself”
A Dillard (source: https://educheer.com/essays/annie-dillard-s-handed-my-own-life/)

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Livecode Enhancements pack - error after update

Post by Klaus » Mon Feb 19, 2024 7:26 pm

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.
Attachments
eml_headers.png

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Livecode Enhancements pack - error after update

Post by Klaus » Mon Feb 19, 2024 7:38 pm

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.

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Livecode Enhancements pack - error after update

Post by Klaus » Mon Feb 19, 2024 7:49 pm


mbossiere
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 44
Joined: Wed Aug 01, 2007 2:15 am
Location: Tucson Arizona US

Re: Livecode Enhancements pack - error after update

Post by mbossiere » Mon Feb 19, 2024 11:16 pm

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.
“You do what you do out of your own private passion for the thing itself”
A Dillard (source: https://educheer.com/essays/annie-dillard-s-handed-my-own-life/)

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Livecode Enhancements pack - error after update

Post by Klaus » Tue Feb 20, 2024 9:54 am

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

mbossiere
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 44
Joined: Wed Aug 01, 2007 2:15 am
Location: Tucson Arizona US

Re: Livecode Enhancements pack - error after update

Post by mbossiere » Fri Feb 23, 2024 4:05 pm

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
“You do what you do out of your own private passion for the thing itself”
A Dillard (source: https://educheer.com/essays/annie-dillard-s-handed-my-own-life/)

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Livecode Enhancements pack - error after update

Post by Klaus » Fri Feb 23, 2024 4:33 pm

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 !? :?

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Livecode Enhancements pack - error after update

Post by Klaus » Fri Feb 23, 2024 4:38 pm

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...
Attachments
emailarray.png

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”