Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pseudo-regexp



A few of you may remember my efforts to work around Mozilla's poor scriptability relative to Eudora. A few months later. I've almost got the problem licked. The key was using GUI scripting to directly manipulate Mozilla's menus rather than trying to query the windows for their contents. Thus, I copy and paste the content I need into AppleScript. It's an ugly, ugly hack but it works, at least some of the time.

The final step is to parse the From: and Date: headers out of the raw message text. This is pretty straight-forward string manipulation, and I I'm hoping it's obvious to someone. In other words, I have this:

...
Message-ID: <email@hidden>
Date: Mon, 28 Feb 2005 10:43:14 -0800 (PST)
From: rlk groups <email@hidden>
To: email@hidden
MIME-Version: 1.0
...

I have this complete message stored in a string variable called rawmessage.

I need to extract "rlk groups <email@hidden>" and "Mon, 28 Feb 2005 10:43:14 -0800 (PST)" and store them in new variables.

Regular expressions would make this task easy, but as far as I know (I could be wrong about this) AppleScript doesn't have these without 3rd party libraries. Is there any straightforward string operations that could pull this off?

If there's not, is there an easy way to call out to Perl or some such to do this work?

And if that's not the case, what's the best cheap regex library for AppleScript? SatImage?

For what it's worth this does not run unattended. I can afford a quick and dirty solution that may fail on some corner cases and have to be manually corrected.

All suggestions are appreciated.

--
Elliotte Rusty Harold  email@hidden
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.