lolipop Posted March 28, 2012 Posted March 28, 2012 Hi, I'm looking for help to do the following task but not really sure if AutoIt script can do the trick. Perhaps someone can advise me and help me in create this script? Basically this is the task. Assume I have 2 outlook profile within the same computer. I wish to automate the task to 1 - Open outlook profile 1 2 - Search for the folder called "Shared Folder" 3 - There is a single file within the Shared Folder. Extract this file out and copy to a temp location. 4 - Close outlook and re-launch outlook using outlook profile 2. 5 - Move or copy the earlier extracted file to this outlook profile 2. There is a folder called Shared Folder 2. Just place it in there. 6 - Close outlook. The script will need to run probably every 2 hours so I'm thinking of using scheduler to run the script. Can this be done using AutoIt. Please help.Thanks.
Juvigy Posted March 28, 2012 Posted March 28, 2012 Yes it can. Chech the Outlook extended UDF created by Water.
lolipop Posted March 28, 2012 Author Posted March 28, 2012 On 3/28/2012 at 7:04 AM, 'Juvigy said: Yes it can. Chech the Outlook extended UDF created by Water.Thanks for the reply but I'm very sorry I'm don't quite understand how the Outlook UDF works. Like I mention before, I'm a total newbie to this autoit thingy. Sorry.
Zedna Posted March 28, 2012 Posted March 28, 2012 Seach this forum for "Outlook" and you will find lots of scripts examples ... Resources UDF ResourcesEx UDF AutoIt Forum Search
water Posted March 28, 2012 Posted March 28, 2012 Quick and dirty: #include <OutlookEx.au3> $sTitle = "Outlook Test Script" $oOutlook = _OL_Open(False, "", 0, 0, "Profile1") If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_Open: " & @error & ", @extended: " & @extended) $aFolder = _OL_FolderAccess($oOutlook, "Your Shared Folder") If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_FolderAccess: " & @error & ", @extended: " & @extended) $aItems = _OL_ItemFind($oOutlook, $aFolder[1], "... Parameters To describe the search follow here ...") If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_ItemFind: " & @error & ", @extended: " & @extended) _OL_Close($oOutlook) Exit My UDFs and Tutorials: Reveal hidden contents 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
lolipop Posted March 28, 2012 Author Posted March 28, 2012 On 3/28/2012 at 7:34 AM, 'water said: Quick and dirty: #include <OutlookEx.au3> $sTitle = "Outlook Test Script" $oOutlook = _OL_Open(False, "", 0, 0, "Profile1") If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_Open: " & @error & ", @extended: " & @extended) $aFolder = _OL_FolderAccess($oOutlook, "Your Shared Folder") If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_FolderAccess: " & @error & ", @extended: " & @extended) $aItems = _OL_ItemFind($oOutlook, $aFolder[1], "... Parameters To describe the search follow here ...") If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_ItemFind: " & @error & ", @extended: " & @extended) _OL_Close($oOutlook) Exit Hi water, Thanks for the advise. I try out your script but somehow it doesn't open the Profile1 automatically. Outlook just start and prompt me which profile to use. Thanks.
water Posted March 28, 2012 Posted March 28, 2012 What version of Outlook do you use? My UDFs and Tutorials: Reveal hidden contents 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
water Posted March 28, 2012 Posted March 28, 2012 If the profile needs a password then use:#include <OutlookEx.au3> $sTitle = "Outlook Test Script" $oOutlook = _OL_Open(False, "", 0, 0, "Profile1", "Your password goes here") If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_Open: " & @error & ", @extended: " & @extended) $aFolder = _OL_FolderAccess($oOutlook, "Your Shared Folder") If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_FolderAccess: " & @error & ", @extended: " & @extended) $aItems = _OL_ItemFind($oOutlook, $aFolder[1], "... Parameters To describe the search follow here ...") If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_ItemFind: " & @error & ", @extended: " & @extended) _OL_Close($oOutlook) Exit My UDFs and Tutorials: Reveal hidden contents 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
lolipop Posted March 28, 2012 Author Posted March 28, 2012 really appreciate your help.The outlook profile doesn't need password. My outlook profile 1 is named "Outlook", profile 2 is "test"I try changing the code to reflect my profile name$oOutlook = _OL_Open(False, "", 0, 0, "Outlook") or$oOutlook = _OL_Open(False, "", 0, 0, "test") doesn't work. any further idea?
water Posted March 28, 2012 Posted March 28, 2012 Do you get an error MsgBox? My UDFs and Tutorials: Reveal hidden contents 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
lolipop Posted March 28, 2012 Author Posted March 28, 2012 no error msg return from _ol_open.Outlook just prompt me to choose the profile to load
water Posted March 28, 2012 Posted March 28, 2012 I will check and - hopefully - post a solution. My UDFs and Tutorials: Reveal hidden contents 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
water Posted March 28, 2012 Posted March 28, 2012 If you start Outlook manually do you have a default profile Outlook connects to or do you still get the prompt? My UDFs and Tutorials: Reveal hidden contents 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
lolipop Posted March 29, 2012 Author Posted March 29, 2012 (edited) If I start outlook manually, I will also get the prompt becos in control panel -> Mail, I have set Outlook to prompt for a profile to be used(pic below). With this setting, when I run the script, I will always get the outlook prompt as shown in the pic above.I have also try setting the Mail option to always use this profile(Outlook), the script works as in no outlook prompt but when I try changing the script code to load another outlook profile such as the test profile, outlook seems to be still loading the Outlook profile(default) rather than the profile I specific in the script. Edited March 29, 2012 by lolipop
water Posted March 29, 2012 Posted March 29, 2012 Make sure that Outlook isn't started when you run the script - else Outlook ignores the parameters passed by the script. Set "Prompt for a profile to be used" and re-try, maybe it works My UDFs and Tutorials: Reveal hidden contents 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
water Posted March 29, 2012 Posted March 29, 2012 Looks like line$oOL_Namespace.Logon($sOL_ProfileName, $sOL_Password, False, False)in function _OL_Open needs to be set to$oOL_Namespace.Logon($sOL_ProfileName, $sOL_Password, True, True) My UDFs and Tutorials: Reveal hidden contents 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
lolipop Posted March 29, 2012 Author Posted March 29, 2012 Tried changing the $oOL_Namespace.Logon but still having the same result. Wheneven the script run, outlook still prompt me to choose the profile to load.Btw, can I know what's the True, True do? Cos I can't find any help/info for this.
water Posted March 29, 2012 Posted March 29, 2012 Sure. Here you can find the Logon method and the required parameters.Could you again change the line to$oOL_Namespace.Logon($sOL_ProfileName, $sOL_Password, False, True) My UDFs and Tutorials: Reveal hidden contents 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
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