minimen456 Posted February 8, 2013 Share Posted February 8, 2013 (edited) $oOutlook = _OL_Open() $Local_Folder = _OL_FolderAccess($oOutlook, "Личные папки\Входящие\antivirus\31.01.2013") $listofmail = _OL_ItemFind($oOutlook, $Local_Folder[1], $olMail, "", "", "", "Subject") Local $oExcel = _ExcelBookNew() ;Create new book, make it visible Local $aArray[5] = ["LocoDarwin", "Jon", "big_daddy", "DaleHolm", "GaryFrost"] _ArrayDisplay($listofmail) _ArrayDisplay($aArray) _ExcelWriteArray($oExcel, 1, 1, $aArray); this one works _ExcelWriteArray($oExcel, 1, 1, $listofmail); this one doesn't work Edited February 8, 2013 by minimen456 Link to comment Share on other sites More sharing options...
water Posted February 8, 2013 Author Share Posted February 8, 2013 _ExcelWriteArray only supports one-dimensional arays. Use _ExcelWriteSheetFromArray to write a two-dimensional array. 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...
minimen456 Posted February 8, 2013 Share Posted February 8, 2013 (edited) But why that Array is two-dimensional? _ArrayDisplay shows me that $listofmail has only one column (I've asked to put only subject of the mail into array) Edited February 8, 2013 by minimen456 Link to comment Share on other sites More sharing options...
water Posted February 8, 2013 Author Share Posted February 8, 2013 Because _OL_ItemFind always returns a 2D arry: "One based two-dimensional array with the properties specified by $sReturnProperties" Add MsgBox(0, "", UBound($listofmail, 0))to your script and you will see that the array has 2 dimensions. 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...
lavascript Posted February 22, 2013 Share Posted February 22, 2013 Water, Your OutlookEX UDF is great! But it's overkill for what I need. I have a script that's generating a file, and at the end, I would like to open a new mail message with the file attached. It would be up to the user to fill in the recipient, subject, body, and anything else. I've looked through the _OL_ItemCreate example docs, but I'm confused, especially about the third param of the function. Am I supposed to literally pass "*Outlook-UDF-TestTargetFolderMail"? Link to comment Share on other sites More sharing options...
water Posted February 22, 2013 Author Share Posted February 22, 2013 (edited) Please have a look at function _OL_Wrapper_SendMail. Does everything you need with a single function call. Edited February 23, 2013 by water 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...
lavascript Posted February 25, 2013 Share Posted February 25, 2013 That works, but I'd really prefer if it could simply display a message instead of actually sending it. What I really want is to replicate the functionality of choosing Send To > Mail Recipient from the Explorer context menu, but I haven't figured out a way to do that. Link to comment Share on other sites More sharing options...
water Posted February 25, 2013 Author Share Posted February 25, 2013 Then simply grab the source of the wrapper function and remove function _OL_ItemSend and replace it with $oItem.Display. 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...
lavascript Posted February 25, 2013 Share Posted February 25, 2013 Thanks! Link to comment Share on other sites More sharing options...
water Posted February 25, 2013 Author Share Posted February 25, 2013 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...
lavascript Posted February 25, 2013 Share Posted February 25, 2013 (edited) Well... that didn't work actually. But I did get it working! Here's what I did for anyone searching. To open a new, BLANK HTML message in Outlook with one attachment: #include <OutlookEX.au3> Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook.") Local $aFolder = _OL_FolderAccess($oOutlook, "", $olFolderOutbox) Local $oItem = _OL_ItemCreate($oOutlook, $olMailItem, $aFolder[1], "", "BodyFormat=" & $olFormatHTML) _OL_ItemAttachmentAdd($oOutlook, $oItem, Default, "C:\FullPath\To\Attachment.zip") _OL_ItemDisplay($oOutlook, $oItem) _OL_Close($oOutlook) Edited February 25, 2013 by lavascript Link to comment Share on other sites More sharing options...
pax Posted February 28, 2013 Share Posted February 28, 2013 (edited) Hi Water, is there any way to disable all outlook rules? With _OL_RuleGet i just can see if a rule is enabled or not. Thanks for your reply :-) Regards Pax Edited February 28, 2013 by pax Link to comment Share on other sites More sharing options...
water Posted February 28, 2013 Author Share Posted February 28, 2013 (edited) Untested, but this should disable all activated rules:$aRules = _OL_RuleGet($oOL, "*", True) For $i = 1 to $aRules[0][0] $aRules[$i][0].Enabled = False Next $sStore = $oOL.Session.DefaultStore.DisplayName $oRules = $oOL.Session.Stores.Item($sStore).GetRules $oRules.Save() Edited February 28, 2013 by water 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...
SkoubyeWan Posted March 7, 2013 Share Posted March 7, 2013 I have a relatively simple script below. It works to open a new email to be sent. Works fine when Outlook is open in the background, but does not work when it is not open. Gives the following error: Error creating mail. @error = 2, @extended = 5. I need this to work whether outlook is already running or not. This script is similar to Lavascripts script above. Tried his as well and it suffers from the same problem. Works when Outlook is already running but doesn't when it is not. Thanks for any input you might have. #include Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) Local $oItem = _OL_ItemCreate($oOutlook, $olMailItem, "") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_ItemCreate Script", "Error creating mail. @error = " & @error & ", @extended = " & @extended) _OL_ItemDisplay($oOutlook, $oItem) WinWaitClose("Message (HTML)") _OL_Close($oOutlook) Link to comment Share on other sites More sharing options...
water Posted March 7, 2013 Author Share Posted March 7, 2013 Which version of the OutlookEX UDF do you run? It shouldn't make a difference if Outlook is running or not. 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...
SkoubyeWan Posted March 7, 2013 Share Posted March 7, 2013 Version 0.9.0 Link to comment Share on other sites More sharing options...
water Posted March 7, 2013 Author Share Posted March 7, 2013 Looks like a bug in the UDF. Needs further investigation. Or you specify the folder where the mail should be created: "*Drafts" 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...
SkoubyeWan Posted March 7, 2013 Share Posted March 7, 2013 I have tried specifying the drafts folder already and it makes no difference. Same error. Thanks for looking at it for me. Link to comment Share on other sites More sharing options...
water Posted March 7, 2013 Author Share Posted March 7, 2013 I'm sure I've asked it before: Which Outlook version? Which operating system? 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...
SkoubyeWan Posted March 7, 2013 Share Posted March 7, 2013 No worries. Outlook 2010 Windows XP SP3 Link to comment Share on other sites More sharing options...
Recommended Posts