Sign in to follow this  
Followers 0
speedi

script problem - compact outlook file

3 posts in this topic

I am trying to make this script to automate "compacting" the MS Outlook file and then close outlook. It will be executed each night.

Opt("WinTitleMatchMode", 2)

If WinExists("Microsoft Outlook") then

WinActivate("Microsoft Outlook")

Send("{CAPSLOCK off}{ALTDOWN}v{ALTUP}gk")

Opt("WinTitleMatchMode", 1)

WinWait("Personal Folders")

Send("{ALTDOWN}f{ALTUP}fi")

Send("{ALTDOWN}v{ALTUP}")

Send("{ALTDOWN}c{ALTUP}")

WinWaitClose("Compact Now")

Sleep(5000)

Opt("WinTitleMatchMode", 3)

WinActivate("Personal Folders")

WinMove("Personal Folders", 345,175, 0)

MouseMove(416,510,0)

MouseClick("left", 416, 510, 0)

WinWaitClose("Personal Folders")

WinActivate("Personal Folders Properties")

WinMove("Personal Folders Properties", "", 329,159, 0)

MouseMove(156,425,0)

MouseClick("left", 156, 425, 0)

WinWaitClose("Personal Folders Properties")

Opt("WinTitleMatchMode", 2)

WinActivate("Microsoft Outlook")

Send("{ALTDOWN}fx{ALTUP}")

else

EndIf

The beginning of it works just great - down to the line underlined. At that point, the "Personal Folders Properties" window is gone (See the WinWaitClose just above the underlined line), but it still shows with "Autoit Window Spy". The script hangs at that point... and the Outlook window can not be focused with a mouse click - it just gives me a boink sound...

Any help would be appreciated very much... I have tried many variations...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

In Outlook and Outlook Express there is a hidden window Named the same that runs in the backround. Add some text, any text to it that you might find, like 'folders'

WinActivate("Microsoft Outlook","folders") ; use autoit window spy to find some text for it.

I had this problem before. I can close the hiden window and it doesn't seem to effect things, but I prefer to leave well enough alone and just be a bit more precise on calling out the window.

Might not be your problem, but info may solve future ones.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Thanks for help...

I used a variation of Larry's code with the "controlclick" to click the OK buttons instead of the mouseclick on OK and better window title selection with the window text qualifier... Thanks again for all input...

Finished code that does the Outlook file compact and then closes outlook is as follows:

If WinExists("Microsoft Outlook") then

ControlFocus("Microsoft Outlook","","Menu Bar")

ControlSend("Microsoft Outlook","","Menu Bar","vgk")

Opt("WinTitleMatchMode", 1)

WinWait("Personal Folders")

ControlFocus("Personal Folders","","Menu Bar")

ControlSend("Personal Folders","","Menu Bar","ffi")

WinWait("Personal Folders Properties")

ControlClick("Personal Folders Properties","","Ad&vanced...")

WinWait("Personal Folders","&Compact Now")

ControlClick("Personal Folders","","&Compact Now")

WinWait("Compact Now")

WinWaitClose("Compact Now")

ControlClick("Personal Folders","","OK")

Opt("WinTitleMatchMode", 3)

WinActivate("Personal Folders Properties","&Folder Size")

ControlClick("Personal Folders Properties","&Folder Size","OK")

WinActivate("Personal Folders - Microsoft Outlook","")

Send("{ALTDOWN}fx{ALTUP}")

else

endif

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
Sign in to follow this  
Followers 0