Flak Posted August 21, 2013 Share Posted August 21, 2013 What I'm trying to accomplish is to automate the process of reattaching pst files in Outlook. In a perfect world this script would check for currently attached pst files, unload them then search the user's network drive and pc for PST files and then move them all to a central location. Then reattach them from that location. But since all of this is new to me, and I apparently took the extremely long route the first time. I found this and instantly felt ashamed at the way I was taking, lol.... So how would this be converted to au3 and hopefully I can use this as an example going forward. So what we do is manually detach pst files, run a search for the user pst(s) then move everything to a central location. We then run this script, tell it where the pst files are located and it re-attaches all of them. const ForAppending = 8 start_folder = inputBox ("Enter Full Path to PST Files") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objOutlook = CreateObject("Outlook.Application") Set objFolder = objFSO.GetFolder(start_folder) set objTextFile = objFSO.OpenTextFile ("C:\Temp\PST_ADD_Log.txt", ForAppending, True) For Each objFile In objFolder.Files If LCase(objFSO.GetExtensionName(objFile.Name)) = "pst" Then WScript.Echo "Found PST:" & objFile.Name On Error Resume Next objOutlook.Session.AddStore objFile.Path If Err.Number <> 0 Then objTextFile.WriteLine(objFile.Name & vbTab & "PST is corrupt or in use") else objTextFile.WriteLine(objFile.Name & vbTab & "PST opened successfully") End If End If Next Link to comment Share on other sites More sharing options...
junkew Posted August 21, 2013 Share Posted August 21, 2013 this should get you started $obj = ObjCreate("Scripting.FileSystemObject") FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
water Posted August 21, 2013 Share Posted August 21, 2013 Please have a look at my OutlookEX UDF. It has some functions to work with PST stores. If you have questions I'm happy to help. 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...
spudw2k Posted August 21, 2013 Share Posted August 21, 2013 this should get you started $obj = ObjCreate("Scripting.FileSystemObject") I would agree, but there are also built-in functions in AutoIt worth learning as far as File System accesses. Perhaps ObjCreate is useful enough to get started as something that could be used with the "Outlook.Application" COM object. After some prolonged expose to AutoIt you'll discover the value of using UDFs too as water recommended (and developed.) I endorse both. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
water Posted August 22, 2013 Share Posted August 22, 2013 To work with files in AutoIt as shown in the example VBS code you don't need to use a FileSystemObject. AutoIt has functions to directly work with files. 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...
spudw2k Posted August 22, 2013 Share Posted August 22, 2013 To work with files in AutoIt as shown in the example VBS code you don't need to use a FileSystemObject. AutoIt has functions to directly work with files. ahem that's what I was eluding too. ...there are also built-in functions in AutoIt worth learning as far as File System accesses. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
water Posted August 22, 2013 Share Posted August 22, 2013 Sorry for my "double" post - just noticed that is was already mentioned by you. 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...
EKY32 Posted August 22, 2013 Share Posted August 22, 2013 did you mean some thing >like this? [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] 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