PDA

View Full Version : Checking unread emails from Outlook


teognost
09-06-2012, 12:18 PM
Attached project is checking unread emails in Outlook.It works ok when launched from GUI or from a batch file like this:
"C:\Program Files\VisBuildPro8\VisBuildPro.exe" /mta /b "C:\Program Files\VisBuildPro8\CheckUnreadEmails.bld"

But I need to have this project always running -therefore I created a scheduled task to run it at startup.
Problem is from scheduled task (is just launching the batch file) the project cannot be ran ,fails like this:

9/6/2012 6:42:34 PM: Building project step 'Check email'...
before creating outlook object
after creating outlook object
Error in Run Script (VBScript) script code at Line 20, Column 1 (Cannot complete the operation. You are not connected.)
9/6/2012 6:42:34 PM: Step 'Check email' failed


or simply remains frozen:

9/6/2012 7:13:13 PM: Building project step 'Check email'...
before creating outlook object
after creating outlook object

I tried not to use a scheduled task but to set automatic logon for Win and then i put the shortcut to batch file in StartUp -same issues appear like in ScheduledTasks.
Basically I cannot run this CheckUnreadEmails.bld continuosly on that machine.
Any idea why I have these issues and if there is any way to avoid them?
I have VBP 8.0 x64 installed on WinServer2008R2 64 bits

kinook
09-06-2012, 05:12 PM
Not sure, but you can reproduce the problem outside of Visual Build by putting the script code in a .vbs file and calling via cscript.exe in a scheduled task.