Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I control outlook messages when sending email
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00880675
Message ID:
00883167
Views:
46
Thanks for staying with me on this,
Do I include the vbs file in the project?
Should it be located in the directory of the exe?
I still get the message "a program is trying to send email" and I have to check "Yes". In debug, it processes the run script with no errors so I don't know if the vb script ran or not.

Thanks

>Hi Chuck,
>
>What error do you get? If it cannot find the script file, try to specify full path.
lcRun = [RUN /N4 cscript "] + FULLPATH("waitforoutlook.vbs") + ["]
>&lcRun
The script has to be stored as a separate file, or copied out before using. You can find more about scripting at http://msdn.microsoft.com/library/default.asp?url=/nhp/default.asp?contentid=28001169.
>
>>Sergey
>>Sorry for taking so long to get back. This is the last piece for an app and I hadn't had time to test it intil now.
>>My problem, I think, is I am trying to run the "VBscript" as Ed's example (#8155) but get a scripting error. Can I create a method and would I still use the same Script or how much of the code would change. As you can see I am a little weak in API stuff. Do I include the "WaitForOutlook.vbs" in the project (had errors) with a prg extension. I am not doing something right.
>>Thanks
>>
>>>Chuck,
>>>
>>>Make sure that WshShell.AppActivate parameter matches the Oulook Dialog title. You can also play with the time script waits for a dialog. To see script execution window you can temporay use
RUN /N4 cscript waitforoutlook.vbs
You can also use Wscript.Echo "..." to display messages.
'VBScript WaitForOutlook.VBS
>>>Set WshShell = Wscript.CreateObject("WScript.Shell")
>>>' this waits 20 seconds from launch to action.  You can experiment with
>>>' shorter or longer durations as necessary
>>>Wscript.Echo "Waiting for Dialog"
>>>Wscript.Sleep 20000
>>>WshShell.AppActivate "Microsoft Outlook"
>>>' wait 1/10th second after requesting activation of the Outlook Window
>>>Wscript.Sleep 100
>>>WshShell.SendKeys "Y"
>>>
Extreme Programming = Plan -> Design -> Code -> Test
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform