 |
 |
Applescript help?
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2010
Status:
Offline
|
|
Hello all. I need some help. I have a mailing list for my business and the way email addresses are entered is like this:
"email","date","ip"
So a quick example would be:
"bob@bob.com","1268080664","XX.XXX.XXX.XXX"
I don't want to use the online email sender, I want to use one one on my mac. I set up automator to download the text file the info is stored in, but then I need it to delete some necessary functions. Before you ask, "Why not just make your PHP file remove the extra stuff?" and my answer is that I want to keep it there incase I use it in the future. So basically, I am wondering how in applescript, I can have it remove everything but the email address. The email is always laying between the first two quotes, so that might make it easier.
If you can help, thank you very much. If not, can you refer me to where I can get help?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2000
Location: Nashua NH, USA
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: May 2007
Status:
Offline
|
|
set x to "\"bob@bob.com\",\"1268080664\",\"XX.XXX.XXX.XXX\" "
set y to text 2 thru -1 of x
set o to offset of "\"" in y
if o > 1 then set e to text 1 thru (o - 1) of y
-->returns bob@bob.com
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Mar 2010
Status:
Offline
|
|
I got this help from another board:
set theData to paragraphs of (read file "path:to:your.txt")
set emailAddresses to {} -- somewhere to store the addresses when we're done
set {old_delims, my text item delimiters} to {my text item delimiters, "\""} -- setup the TIDs
repeat with eachLine in theData
copy text item 2 of eachLine to end of emailAddresses -- extract the email address
end repeat
set my text item delimiters to old_delims -- clean up when we're done
How would I then have it save it as a second text file, named email2.txt?
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Mar 2001
Location: yes
Status:
Offline
|
|
If this mailing list is large, you can parse the addresses faster in the Unix command line than Applescript, and you would be better off not sending this from a desktop email client if you are interested in sending HTML mail and not having your message flagged as spam and/or not figuring out the max recipients in a single message supported by your email service provider.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jul 2002
Status:
Offline
|
|
Originally Posted by PXL Creations
I got this help from another board:
set theData to paragraphs of (read file "path:to:your.txt")
set emailAddresses to {} -- somewhere to store the addresses when we're done
set {old_delims, my text item delimiters} to {my text item delimiters, "\""} -- setup the TIDs
repeat with eachLine in theData
copy text item 2 of eachLine to end of emailAddresses -- extract the email address
end repeat
set my text item delimiters to old_delims -- clean up when we're done
How would I then have it save it as a second text file, named email2.txt?
You could also use this:
set filePath to "/path/to/file.txt"
set savePath to "/path/to/file_save.txt"
do shell script "awk -F\",\" '{print $1}' " & filePath & " | sed 's/\"//g' > " & savePath
This'll export your results to a the text file "file_save.txt"
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|