Sign in to follow this  
Followers 0
grafis

Saving Outlook Messages - Word Editor

3 posts in this topic

I have a script that is Closing Microsoft Outlook and saving open emails, works great unless the default of Microsoft Word as editor is enabled. Then my script isn't effective unless I manually bring the Save Dialog into focus.

What appears to be happening is on sending Outlook the close Command the Save dialog for MS Word goes into the background and "winActive" isn't bringing it to the fore.

I have the parent Window "Outlook", first child "Message" and then a dialog "word" with text "save the changes"

This does nothing:

While oAutoIt.WinExists("", "save the changes")  'Process all dialogs that have "save changes" in it 
    oAutoIt.WinActivate "", "save the changes"  'Activate the dialog
    oAutoIt.Sleep 1000 ' Wait 1 second
    oAutoIt.Send "{Y}" ' Press y key to say yes to save
    oAutoIt.Sleep 1000 ' Wait 1 second
 Wend

This works IF I manually bring the Save Dialog into Focus (Dangerous! as it hits any open Word Document as well, without the requirement to manually focus)

While oAutoIt.WinExists("Word")  'Process all dialogs that have "save changes" in it 
    oAutoIt.WinActivate "Word"  'Activate the dialog
    oAutoIt.Sleep 1000 ' Wait 1 second
    oAutoIt.Send "{Y}" ' Press y key to say yes to save
    oAutoIt.Sleep 1000 ' Wait 1 second
 Wend

Any help appreciated!

ps love this tool, it's a life saver I just discovered!!

Share this post


Link to post
Share on other sites

You could try using _WordAttach() and then _WordQuit().

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You could try using _WordAttach() and then _WordQuit().

Hi, would I try those as Window names or window contents? Sorry, new to Autoit.

The issue for me is I'm *not able to pull the Save dialog box into focus. It's parent (an email message) is flashing in the task bar after I send a quit command to Outlook but I can't pull the Save Dialog forward to send it a {Y} command. If I bring it forward manually then my script saves and closes the email instantly.

Outlook is a fun one as Window names can be very differnt in all kinds of cirucmstance so I'm using Window text which is exactly the same (confirmed by Autoit) for Outlook messages being saved with Outlook as the editor and when Word is the editor. Script works great untill Word is the editor then the dialog for some reason goes to the back of the stack and Autoit isn't able to find it.

My Goal - is to Close Oulook and save any unsaved emails.

I'm using this method: http://www.smsexpert.com/Products/SaveData.aspx

thanks,

- g

Edited by grafis

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