autoit0822

Compact MS Outlook 2010 OST Files

12 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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.


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@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

Share this post


Link to post
Share on other sites

@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

 


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

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

This is what I see:

2015-11-01_09_17_04-Dimmer.thumb.png.c1c

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Share this post


Link to post
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 (2016-08-18 - Version 1.4.6.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2016-12-04 - Version 1.2.2.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
Tutorials:
ADO - Wiki

 

Share this post


Link to post
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()

 

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites
  1. When the script finds a PST file (window title "Outlook Data File"), that window remains open and the script stalls.

If _GUICtrlListView_ClickItem finds a PST file (window title "Outlook Data File"), how can I close that window and continue?

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