I am writing an apple script and have run across a major problem. I need to, within a resonable amout of time, figure out how to extract a segment of text based on what is in front and behind of it. My script opens a txt file and reads the contents. It then need to extract any text folowing the phrase “emailto:” and stopping at but including the .com, .net, .edu, etc… Any help would greatly be appriciated. If you need to look at the applescript then just contact me at david_coffey@soonersci.com.
Use any number of the scriptable text editors. For this I’d recommend BBEdit. If you’re on OSX, use Perl instead of Applescript. If you’re on OS9 or earlier, add the regexp scripting addition. Check Version Tracker for email address extraction programs.
I need to create an applescript that will extract the information inbetween the “emailto:” and the “>” header of an html page. I already have applescript set up to do this, but I am having trouble with this part. and example would be the html code would read something like this:
… emailto:david_coffey@soonersci.com …
how would I open this file, and extract the information I am looking for in between those two markers, and export them to a text file. I am hoping to use standard additions to accomplish this. Please note: I don’t know what the email address will be in any case on this. Once again, If you need to look at the script, Just let me know and I will email it to you in text format.
Sincerely, David Coffey
: I need to create an applescript that will extract the information inbetween
: the “emailto:” and the “>” header of an html page.
: I already have applescript set up to do this, but I am having trouble with
: this part. and example would be the html code would read something like
: this: … …
: how would I open this file, and extract the information I am looking for in
: between those two markers, and export them to a text file. I am hoping to
: use standard additions to accomplish this. Please note: I don’t know what
: the email address will be in any case on this. Once again, If you need to
: look at the script, Just let me know and I will email it to you in text
: format.
This handler might give you what you need to extract the address. The
Standard Additions can handle the export (write command).
extractAddresses
Later,
Rob J