powermail-discuss Digest #2935 - Thursday, August 4, 2011

  AppleScript Sender Question
          by "Tom Dillon" <[email protected]>
  Re: AppleScript Sender Question
          by "Beatrix Willius" <[email protected]>


----------------------------------------------------------------------

Subject: AppleScript Sender Question
From: "Tom Dillon" <[email protected]>
Date: Wed, 3 Aug 2011 19:12:51 -0600

Howdy y'all,

When using the scrip below, the variable 'theSender' is always populated with 
what looks like Chinese characters rather than the sender's name and email 
address as I would have expected. Is there something I'm missing here?

Thanks

set theCR to "
"
set theFD to theCR & "----------" & theCR

tell application "PowerMail"
        set theMessages to current messages
        repeat with msg in theMessages
                set theSender to sender of msg as text
                set theTitle to subject of msg as text
                set theTime to time received of msg as text
                set theBody to content of msg as text
                
                set theText to theSender & theFD & theTitle & theFD & theTime & 
theFD & theBody & theFD
                set the clipboard to theText
        end repeat
end tell

--
   ------------------------------------------------------------------
   Tom Dillon                                           825 N. 500 W.
   DataCraft                                           Moab, UT 84532
   [email protected]                           720/209-6502
   ------------------------------------------------------------------
            The life you chase,
            will eventually catch up to you.  --- Sunastar
   ------------------------------------------------------------------



----------------------------------------------------------------------

Subject: Re: AppleScript Sender Question
From: "Beatrix Willius" <[email protected]>
Date: Thu, 4 Aug 2011 16:40:36 +0200

Hi Tom,

chinese characters almost always are an indication that text encoded as UTF8 is 
interpreted as UTF16. A simple explanation is here:

http://www.satimage.fr/software/en/smile/text/unicode_and_applescript.html

That the sender is UTF16 is most likely a bug (looks very nice, by the way). I 
didn't find a way to do the conversion in AppleScript. The following page has a 
simple script to do this with Python:

http://macscripter.net/viewtopic.php?id=25319

HTH

On Aug 4, 2011, at 3:12 AM, Tom Dillon wrote:

> Howdy y'all,
> 
> When using the scrip below, the variable 'theSender' is always populated with 
> what looks like Chinese characters rather than the sender's name and email 
> address as I would have expected. Is there something I'm missing here?
> 
> Thanks
> 
> set theCR to "
> "
> set theFD to theCR & "----------" & theCR
> 
> tell application "PowerMail"
>       set theMessages to current messages
>       repeat with msg in theMessages
>               set theSender to sender of msg as text
>               set theTitle to subject of msg as text
>               set theTime to time received of msg as text
>               set theBody to content of msg as text
>               
>               set theText to theSender & theFD & theTitle & theFD & theTime & 
> theFD & theBody & theFD
>               set the clipboard to theText
>       end repeat
> end tell

Mit freundlichen Grüßen/Regards

Trixi Willius

http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals


----------------------------------------------------------------------
End of powermail-discuss Digest

Reply via email to