Link to home
Start Free TrialLog in
Avatar of Talal216
Talal216

asked on

Run a program after email arrival

Dear Experts,

I am looking for a script/macro which would process the contents of incoming emails and execute a certain application when a certain condition is met.

Your help will be greatly appreciated!

Thanks
Avatar of David Lee
David Lee
Flag of United States of America image

Hi, Talal216.

I might be able to help with that.  I'd need to know more about the condition and details of the program you want to run.
Avatar of Talal216
Talal216

ASKER

Hey BlueDevilFan,

Its great to hear from you again :)

Okie.I hope you can help me on this as i am pretty much packed with deadlines and i need a good experts help.

The steps to be followed are :-
1)User sends email to Support@xyz.com
2)The processor/script is running for each email received.
3)When the processor finds the following words "DECEMBER 2009 REPORT for Shipping Department"
4)An email is sent back to the user saying that the report will be ready in 1 hours time.
5)If the same request is received in less than one hours time,the script will send the message back saying "Cannot process request,earlier report still processing."
6) A text file is opened in the directory (c:\myscripts\shipping) and the MONTH and Year is put in that.
7)The exe file located in the c:\myscripts\shipping folder is started which will generate the report which can be send later.

Note:the .exe file is not an excel file.
Everything but #5 is pretty simple.  What happens to a message after it's been received and responded to?  Also, please refresh my memory on the version of Outlook you're using.
The exe file  needs about 45 minutes to run.if the exe files are executed twice it might overload the application and it might crash. The exe file , basically after execution will invoke an excel macro which will do further calculations on the report and the compiled report would be sent as attachment. back to the user.

A small idea for #5 would be when the text file is made, the time of the execution  is also put along with the Month and Year.So when the script is executing again it will check the time and compare the difference.

I am using Outlook 2007.

Thanks!

The message is closed after it is responded in step #4 or #5 depending on the situation.
Hi BlueDevilFan,

Do you think  my idea /suggestion is fine or do you think there is a better way to solve that?

Thanks!

ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey not a problem BDF :)


Thank you very much for the script but i hit an compile error indicating invalid use of an object at line number 9 in the above script.Please assit me to sort it out :)

Thanks once again BlueDevilFan.
The word Nothing should be in quotes.  Like this

If TypeName(olkItem) = "Nothing" Then
Dear BlueDevilFan,

First of all Seasons greetings to you!

It works like a charm.

Perfecto !.

You are the real Guru,I would be extending this script to suit my requirements,if i get stuck i will get back to you and probably pop up another question.

Thanks ones again.I am awarding you the full points.

Expert is truly a guru
Thanks, Talal216.  Glad I could be of assistance.  Seasons greetings to you too!
Dear Blue Devil Fan,

Could you please explain what exactly happens in line 8 and the following subsequent line 9 ?Others i can easily follow thanks to your valuble comments.


Line 8 searches for an item from the same sender received within the last hour.  It addresses your requirement #5.  Line 9 tests to see if one was found.
Thanks  for clarifying ,much appreciated.

You're welcome.