Jump to content

Auto Compress PST's


Klexen
 Share

Recommended Posts

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
Link to comment
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

Link to comment
Share on other sites

  • 5 years later...

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.

Link to comment
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 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

  • 1 year later...

Advertising commercial products isn't allowed here.

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...