Jump to content

Compact MS Outlook 2010 OST Files


Recommended Posts

I am trying to adapt this script to work in MS Outlook 2010 on Windows 7 x64. To begin with:

;//$Path = FileGetShortName(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls", "mlcfg32.cpl"))
;//Run(@SystemDir & "\control.exe " & $Path)
Run('%WINDIR%\SysWOW64\control mlcfg32.cpl')

Then, at the point the script goes into each listed data file, this window doesn't seem to be accounted for:

2015-10-29_14_05_35-Microsoft_Exchange.t

Edited by autoit0822
Link to comment
Share on other sites

  • Moderators

@autoit0822 in the future, please pay attention to which forum you post in. The Examples forum clearly states that it is not a place for seeking Help.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@autoit0822 in the future, please pay attention to which forum you post in. The Examples forum clearly states that it is not a place for seeking Help.

On reviewing the post from which I started this topic, I see from the bottom of the screen that it is in the Examples forum: perhaps it could have been made more conspicuous what forum I was starting a new topic in?

This code works with Outlook 2010 (French version), you will have to change the title of each window :

http://www.autoitscript.fr/forum/viewtopic.php?p=95920#p95920

Thank you; however, the script does not take account of Exchange (.ost) data files as pictured above. Would you be able, please, to adapt the script to compress Exchange (.ost) data files, and ignore .pst data files?

Edited by autoit0822
Link to comment
Share on other sites

  • Moderators

@autoit0822 It was a friendly request to pay more attention. Please note, it is pretty clearly stated at the top of that particular forum...

Examples.thumb.png.fabd7153b5fa8dc562ec4

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

This script selects and compacts PST files, but not OST files:

;//Source: http://www.autoitscript.fr/forum/viewtopic.php?p=95920#p95920
#include <GUIListView.au3>
Opt("WinTitleMatchMode", 4)

SplashTextOn("Microsoft Outlook 2010 Data File Compacter", "Compacting data files...", 250, 40)

$Path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls", "mlcfg32.cpl")
Run(@SystemDir & "\control.exe " & $Path)

$hMailCfg = WinWait("Mail Setup", "E-mail Accounts")
ControlClick("Mail Setup", "E-mail Accounts", "Button2")

$hAccountWindow = WinWait("Account Settings", "Data Files")

$hlist = ControlGetHandle($hAccountWindow, "", "[CLASS:SysListView32; INSTANCE:2]")
If @error Then Exit
$arraycount = _GUICtrlListView_GetItemCount($hlist)
If Not $arraycount Then Exit MsgBox(16, "", "No data file found.")

Local $ltext[$arraycount]
For $i = 0 To $arraycount - 1
    _GUICtrlListView_ClickItem($hlist, $i, "left", False, 2)
    $hDataFile = WinWait("Outlook Data File", "Outlook Data File")
    ControlClick($hDataFile, "", "Button2")
    $hWait = WinWait("Compact Now")
    WinWaitClose($hWait)
    WinClose($hDataFile)
Next

WinClose($hAccountWindow)
WinClose($hMailCfg)

SplashOff()

If an OST file is selected, this additional window needs to be accounted for:

2015-10-29_14_05_35-Microsoft_Exchange.t

I would like to adapt the script to take account of OST files, and ignore PST files.

Edited by autoit0822
Link to comment
Share on other sites

Why did you open a new thread? You already have a tread that should cope with OST too.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

The following code works for me, with an Exchange mailbox (French configuration) :

#include <GUIListView.au3>
#include <GuiTab.au3>

Opt("WinTitleMatchMode", 4)

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

$Path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Control Panel\Cpls", "mlcfg32.cpl")
Run(@SystemDir & "\control.exe " & $Path)

$hMailCfg = WinWait("Configuration de la messagerie", "Comptes de messagerie")
ControlClick("Configuration de la messagerie", "Comptes de messagerie", "Button2")

$hAccountWindow = WinWait("Paramètres du compte", "Fichiers de données")
$hlist = ControlGetHandle($hAccountWindow, "", "[CLASS:SysListView32; INSTANCE:2]")
If @error Then Exit
$arraycount = _GUICtrlListView_GetItemCount($hlist)
If Not $arraycount Then Exit MsgBox(16, "", "Aucun fichier de données trouvé")

Local $ltext[$arraycount]
For $i = 0 To $arraycount - 1
    _GUICtrlListView_ClickItem($hlist, $i, "left", False, 2)
    $hExchange = WinWait("Microsoft Exchange", "")
    $hTab = ControlGetHandle($hExchange, "", "[CLASS:SysTabControl32; INSTANCE:1]")
    _GUICtrlTab_ClickTab($hTab, 1)
    
    $hParameters = ControlGetHandle($hExchange, "", "[TEXT:Paramètres du &fichier de données Outlook...]")
    If ControlCommand($hExchange, "", $hParameters, "IsEnabled") Then
        ControlClick($hExchange, "", $hParameters)
        $hDataFile = WinWait("Paramètres du fichier de données Outlook")
        ControlClick($hDataFile, "", "[CLASS:Button; INSTANCE:2]")
        $hWait = WinWait("Compresser")
        WinWaitClose($hWait)
        WinClose($hDataFile)
    EndIf
    WinClose($hExchange)
Next

WinClose($hAccountWindow)
WinClose($hMailCfg)

SplashOff()

 

Link to comment
Share on other sites

Thank you! A couple of points, though:

  1. When the script finds a PST file (window title "Outlook Data File"), that window remains open and the script stalls.

  2. $hParameters = ControlGetHandle($hExchange, "", "[TEXT:Outlook Data &File Settings...]")

    Why is the requisite ampersand placed before "File" when an access key is not designated in the button?

Edited by autoit0822
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...