Klexen

Auto Compress PST's

5 posts in this topic

#1 ·  Posted (edited)

I wrote this so we could have users at work run it and automatically compress their PST's. Depending on the size, it could take several hours!

#include <GUIListView.au3>


;~ BlockInput(1)

SplashTextOn("Compacting now", "This may take hours...", 250, 40)

;//Runs the mail application that is in control panel.
$Path = FileGetShortName(@CommonFilesDir & "\System\MSMAPI\1033\MLCFG32.CPL")
Run(@SystemDir & "\control.exe " & $Path)

WinWait("Mail Setup", "", 3)
ControlClick("Mail Setup", "", 1109, "left", 1) ; Click data files
WinWait("Outlook Data Files", "", 3)

;//Gets list of data files listed
$sTitle = "Outlook Data Files"
$hWnd = WinGetHandle($sTitle)
If @error Then Exit
WinActivate($hWnd)
$hlist = ControlGetHandle($hWnd, "", "SysListView321")
If @error Then Exit
$arraycount = _GUICtrlListView_GetItemCount($hlist)
Local $ltext[$arraycount]

$i = 0
Do
    $ltext[$i] = _GUICtrlListView_GetItemText($hlist, $i)
    $i = $i + 1
Until $i = $arraycount

;//Goes into each listed Data file and compresses them
$b = 0
Do

    _GUICtrlListView_ClickItem($hlist, $b, "left", False, 2)
    Sleep(1000)
    ControlClick("Personal Folders", "", "[CLASS:Button; INSTANCE:2]") ; click Compact Now
    Sleep(1200)
    If WinExists("Compact Now") Then WinWaitClose("Compact Now")

    WinClose("Personal Folders")

    $b = $b + 1
Until $b = $arraycount
WinClose("Outlook Data Files")
WinClose("Mail Setup")

;~ BlockInput(0)
Edited by Klexen

Share this post


Link to post
Share on other sites



I wrote this so we could have users at work run it and automatically compress their PST's. Depending on the size, it could take several hours!

Haven't tried it yet but THANKS. I've got several BIG PST file for the various groups I subscribe to and it's such a bore compressing them all. The only other thing that would be usefull is an automatic recyling bin emptier. I only found out a little while ago (Logical now I know) that each PST has it's own Recyling bin and has to be empied indiviually..sigh

Now I can just run this and check it out next day. :D

Keep up the good work

John Morrison

aka

Storme

Share this post


Link to post
Share on other sites

Auto compression of PST file is possible only if you use third party tools. By using third party tools you will get various options to compress PST file and moreover third party tool provides user option to separate attachments from PST file and save then in a different file folder.

Share this post


Link to post
Share on other sites

Welcome to AutoIt and the forum! Did you notice that this post mor than 4 years old? Please do not necro old posts ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Advertising commercial products isn't allowed here.

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now