Is there any way to have a script watch a folder for other folders being placed into it, and within those folders lies a text file with an email address in it. Look at each text file for the email adress and then automatically send an email to that address. :?
Hi,
You could do this in many ways and you shouldn’t begin with a folder action. You need to think of more specific things in your script. I have the Jaguar version of mail and it seems as if many people don’t have this, so here’s one way that should work in both OSs as a start. Firstly, I made a couple of text files and placed them in a folder iwith some other non-text files. One of the text files looks like this:
mailto:kelhak@hawaii.rr.com
subject=Greetings friend!
body=Hello, how are you?
I am fine.
Then, the following script gets the folder from the user, looks through the folder for any text files (with extension) whose text begins with mailto. The script reads the paragraphs of the text for the mailto tags(?). Then the rest is automatic with the ‘open location’ command. I just did this quickly so it needs work, but is an example not knowing what system you’re running:
–on adding folder items to this_folder after receiving these_items
set these_items to (choose folder) as list
repeat with this_item in these_items
set item_info to (info for this_item)
if folder of item_info then
set sub_list to (list folder this_item without invisibles)
repeat with this_sub in sub_list
set sub_ref to ((this_item as string) & this_sub) as alias
set sub_info to (info for sub_ref)
if (name extension of sub_info is “txt”) then
set the_text to (read sub_ref)
if the_text begins with “mailto” then
set the_paragraphs to (every paragraph of the_text)
set the_mailto to (paragraph 1 of the_text)
set the_subject to “?” & (paragraph 2 of the_text)
set the_content to “&” & (text from paragraph 3 to -1 of the_text)
set the_url to (the_mailto & the_subject & the_content)
open location the_url
end if
end if
end repeat
end if
end repeat
–end adding folder items to
After this, the email may be sent through your default email program.
From this, you can see that there are many ways to do this. Your text file can be written in different ways. You may have different email programs. There are many differences between the current version of Mail and previous versions. You don’t need to use ‘open location’, but directly script the mail program.
Nobody, replied so I just thought of giving you a start.
gl,
This line from the script is not needed anymore:
set the_paragraphs to (every paragraph of the_text)
Hi Kel
Thanks for the reply. I am not a scripting genius so i am asking if you could right me a script and guide me through it on how to set it up. i am willing to pay you for this.
I am running OSX panther and the email client will be mail or Entourage. Every thing needs to be automatic. Meaning the collection fo any data in text files to be added to the email and the sending of email.
Hope to hear your reply shortly
thanks stuart
Hi rosslyn46,
There are a lot of good scripters here that would probably do this easily for free. As I wrote in the other post, I am not running Panther which runs a different version of Mail than in the Jaguar system. They would probably want to know if you wanted to send an email from the default email app (Entourage or Mail) or from either one of these.
My script in the previous post might be a starter for running the default email app. The next step in the script, would be to check which app opened. Then you could script the app to send the outgoing mail. However, choosing to script one of the email apps might be easier (Entourage or Mail).
gl,