water Posted May 18, 2013 Author Share Posted May 18, 2013 Haven't used it before so we will need to do some investigation. Let me check Google and I will come back with either more questions or an example script for you to test. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted May 18, 2013 Author Share Posted May 18, 2013 This should do the trick: $oItem = _OL_ItemCreate(....) $oItem.SendUsingAccount = $oOL.Session.Accounts.Item(2) _OL_ItemSend($oOL, $oItem, ...) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
ngskicker Posted May 18, 2013 Share Posted May 18, 2013 Thanks water, i'll try it, Link to comment Share on other sites More sharing options...
ngskicker Posted May 19, 2013 Share Posted May 19, 2013 Hey water, i have a problem and don't know how to resolve it #AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y #include <OutlookEX.au3> Global $oItem, $Result, $sRecipient = "mymail@yahoo.com" Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "", "", "Subject=AutoItYe", "BodyFormat=" & $olFormatPlain, "Importance=" & $olImportanceHigh, _ "Body=Bodytext in <b>bold</b>") _OL_ItemRecipientAdd($oOutlook, $oItem, Default, $olTo, $sRecipient) If @error <> 0 Then Exit MsgBox(16, "_OL_ItemRecipientAdd", "Error sending mail, @error = " & @error & " " & @extended) ; In above line i get error 600 and extended -2147023174 $oItem.SendUsingAccount = $oOutlook.Session.Accounts.Item(2) $Result = _OL_ItemSend($oOutlook, $oItem, Default) If @error <> 0 Then Exit MsgBox(16, "_OL_ItemSend", "Error sending mail, @error = " & @error & " " & @extended) MsgBox(64, "OutlookEX UDF: _OL_ItemSend Example Script", "Mail successfully sent!") _OL_Close($oOutlook) The above script will generate an error and the email will not be sent, but if I open outlook then the entire email that was not sent will be send immediately, in addition to that, if I open outlook and then run the script above error does not occur and email succesfully sent, Thanks, Link to comment Share on other sites More sharing options...
water Posted May 19, 2013 Author Share Posted May 19, 2013 Can you please add _OL_ErrorNotify(2) at the top of your script so we get detailed error information? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
ngskicker Posted May 19, 2013 Share Posted May 19, 2013 I put it at the very top of my script after #include <OutlookEX.au3> and what i get is 3 message box with the following contents COM Error Encountered in OutlookSender.au3 OutlookEx UDF version = 0.9.0 @AutoItVersion = 3.3.8.1 @AutoItX64 = 1 @Compiled = 0 @OSArch = X64 @OSVersion = WIN_8 Scriptline = 176 NumberHex = 800401E3 Number = -2147221021 WinDescription = Operation unavailable Description = Source = HelpFile = HelpContext = 0 LastDllError = 14007 COM Error Encountered in OutlookSender.au3 OutlookEx UDF version = 0.9.0 @AutoItVersion = 3.3.8.1 @AutoItX64 = 1 @Compiled = 0 @OSArch = X64 @OSVersion = WIN_8 Scriptline = 2436 NumberHex = 800706BE Number = -2147023170 WinDescription = The remote procedure call failed. Description = Source = HelpFile = HelpContext = 0 LastDllError = 0 COM Error Encountered in OutlookSender.au3 OutlookEx UDF version = 0.9.0 @AutoItVersion = 3.3.8.1 @AutoItX64 = 1 @Compiled = 0 @OSArch = X64 @OSVersion = WIN_8 Scriptline = 3101 NumberHex = 800706BA Number = -2147023174 WinDescription = The RPC server is unavailable. Description = Source = HelpFile = HelpContext = 2097266 LastDllError = 0 Link to comment Share on other sites More sharing options...
water Posted May 19, 2013 Author Share Posted May 19, 2013 "Operation unavailable" is expected. The script tries to connect to a running Outlook instance. If Outlook doesn't run you get this message. I'm investigatin the other error messages. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
ngskicker Posted May 19, 2013 Share Posted May 19, 2013 (edited) When i put _OL_ErrorNotify(2) below _OL_Open() I only get 2 last error. Edit: I did a search about "The RPC server is unavailable." and found this, http://msdn.microsoft.com/en-us/library/dd239276.aspx might be useful for you. Edited May 19, 2013 by ngskicker Link to comment Share on other sites More sharing options...
water Posted May 19, 2013 Author Share Posted May 19, 2013 As I said above the first message is expected. It's more of an informational message. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted May 19, 2013 Author Share Posted May 19, 2013 Could you please add a "Sleep(5000)" after _OL_Open? I once had a problem with a badly coded addin - it was related to MS Word, but who knows? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
ngskicker Posted May 19, 2013 Share Posted May 19, 2013 sorry water, but it does not help Link to comment Share on other sites More sharing options...
water Posted May 19, 2013 Author Share Posted May 19, 2013 Could you try to send the mail to your own mail address? Are you connected to an Exchange server? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
ngskicker Posted May 19, 2013 Share Posted May 19, 2013 I do not know what it is "Exchange Server" so I guess I did not connect to it, I still can not send email anywhere as long as I do not open the outlook, if I open outlook no error occurred Link to comment Share on other sites More sharing options...
water Posted May 19, 2013 Author Share Posted May 19, 2013 Google recommends to reboot the PC when the "The RPC server is unavailable" message appears. Does this help? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
ngskicker Posted May 19, 2013 Share Posted May 19, 2013 I guess this will not help, I had this error since yesterday, and until now I've shut down my computer several times, but the error still appears, I guess I would choose to open outlook before running this script, after all, keep outlook open is not a difficult thing to do, thanks anyway water. Link to comment Share on other sites More sharing options...
water Posted May 19, 2013 Author Share Posted May 19, 2013 But it is still strange and a completely unexpected behaviour. I like my UDF to be as reliable as possible. And I like to understand what's going on. A last try: Does it help when you replace $oItem.Close(0) in function _OL_ItemCreate with $oItem.Save() Looks like Outlook shuts down as soon as there is no longer a reference to an item. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted May 19, 2013 Author Share Posted May 19, 2013 After more investigation I'm sure the behaviour we see is described here (Application Shutdown Changes in Outlook 2007 SP2). Outlook shuts itself down if there is no open window (which is always true when started by _OL_Open) and there is no open reference to an Outlook item (mail, appointment ...). So a bug in the UDF causes Outlook to shut down prematurely. The solution I provided above should solve the problem. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
ngskicker Posted May 19, 2013 Share Posted May 19, 2013 I try to replace $oItem.Close(0) in function _OL_ItemCreate with $oItem.Save() but it still does not help Link to comment Share on other sites More sharing options...
water Posted May 20, 2013 Author Share Posted May 20, 2013 Strange. Will have to do more testing ... My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted May 20, 2013 Author Share Posted May 20, 2013 With the latest version of the UDF the script runs fine even when Outlook wasn't up and running. OutlookEx 0.9.1.0.zip My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts