littlebigman Posted April 17, 2012 Share Posted April 17, 2012 Hello I need to interact with Outlook 2007. At some point, a window pops up and I need to put the focus on a control with Class=RichEdit20WPT and Instance=8. What is the right way to do this? Should I use ControlFocus(), where "ID" is synonymous with "Instance"? Thank you. Link to comment Share on other sites More sharing options...
water Posted April 18, 2012 Share Posted April 18, 2012 What do you want to do with Outlook? There is an UDF available that might do what you need. For download please see my siganture. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
littlebigman Posted April 19, 2012 Author Share Posted April 19, 2012 Thanks for the help. For each item in Contacts, I need to edit a few fields, eg. numbers in the Phone Numbers section. Since Outlook doesn't provide keyboard shortcuts to put the focus on eg. the Home phone number, I figured I should use the revelant function to put the focus on that item. If there's an Outlook UDF that makes it easier, I'm definitely interested. Thank you. Link to comment Share on other sites More sharing options...
water Posted April 19, 2012 Share Posted April 19, 2012 That should be possible with my UDF. In short: _OL_Open ; Open the connection to Outlook _OL_FolderAccess ; Access the contact folder _OL_ItemFind ; Find all or some contacts _OL_ItemModify ; Modify the contacts in a loop _OL_Close ; Close the connection to Outlook If you would like to use the Outlook UDF I can give more details how to code the script. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
littlebigman Posted April 20, 2012 Author Share Posted April 20, 2012 Yes, please. I only have shallow knowledge of AutoIT, so any help/samples can help :-) Link to comment Share on other sites More sharing options...
littlebigman Posted April 23, 2012 Author Share Posted April 23, 2012 (edited) I downloaded and unzipped , but the included web pages are references to the different functions it provides while I would need a tutorial on how to get started. I also checked its wiki, but it doesn't contain samples either.I need to loop through all the items in Contacts and, for each, edit some fields that contain wrong characters.Would someone have some code handy that an AutoIT newbie could use to get up and running?Thank you.---Edit: Here's what I did:1. From the , copied OutlookEX.au3 into AutoIt3Include2. Since I'm using the Scite editor, copied au3.user.calltips.api into AutoIt3SciTEapi. I tried to copy au3.userudfs.properties into AutoIt3SciTEproperties, but there is no such file or directory. Instead, there's au3.keywords.properties, so just copied au3.userudfs.properties in the same directory3. Launched Scite, copy/pasted and hit F7 to build:Aut2Exe Error: Line 8 (File "C:AppsAutoIT3.3.8.1IncludeOutlookEX.au3"):#include <OutlookExConstants.au3>Error: Error opening the file.4. So copied OutlookEXConstants.au3 into AutoIt3Include as well, hit F7... and it builds OK.5. After launching Outlook and running the AutoIT script, it does open the Contacts tab, but displays this dialog: "OutlookEX UDF: _OL_ItemFind Example Script. Number of items found: 0"" Edited April 23, 2012 by littlebigman Link to comment Share on other sites More sharing options...
water Posted April 23, 2012 Share Posted April 23, 2012 Something like this.It displays all contacts in your contact folder in an array.Before you click on "YES" to alter every item you need to set the properties you want to change: "<property=value,property=value>" needs to be replaced!#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y #include <OutlookEX.au3> #include <array.au3> ; Open conenction to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error opening connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; Access the default contacts folder of the current user Global $aFolder = _OL_FolderAccess($oOutlook, "", $olFolderContacts) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error accessing the default contacts folder. @error = " & @error & ", @extended = " & @extended) ; Get a list of all contacts in folder Global $aOL_Item = _OL_ItemFind($oOutlook, $aFolder[1], $olContact, "", "", "", "FullName,EntryID") If @error Then Exit MsgBox(16, "OutlookEX UDF", "Error searching for items in the contacts folder. @error = " & @error & ", @extended = " & @extended) If $aOL_Item[0][0] = 0 Then Exit MsgBox(16, "OutlookEX UDF", "Could not find a contact item in the default contact folder. @error = " & @error & ", @extended = " & @extended) _Arraydisplay($aOL_Item) ; Ask user if he wants to modify all items Global $iReply = MsgBox(36, "OutlookEX UDF", "Do you want to modify all displayed contact items?") If $iReply = 6 Then ; Modify all found items For $i = 1 To $aOL_Item[0][0] _OL_ItemModify($oOutlook, $aOL_Item[$i][1], Default, "<property=value,property=value>") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error modifying a contact item. @error = " & @error & ", @extended = " & @extended) Next EndIf ; Close connection to Outlook _OL_Close($oOutlook) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now