Guest manboak Posted July 12, 2004 Share Posted July 12, 2004 Hi - Under the File Menu in Outlook 2003 you can 'Save as Web Page' - I would like to automate this so that others can look at my calendar on a network drive or (ideally) get it ftp'd to a website for people outside my network. I've spent about 3 hours trying a variety of approaches. My VBA is pretty weak so I thought Autoit would fill the gap but nothing seems to work. I can get autoit to open outlook in the Calendar view (using a command line switch) but I can access the appropriate menu control. Below is the syntax I've tried - much of it was commented out after it did not work. Any help would be appreciated. This is my last try for a few months on this as I can't justify spending more hours on this right now. Thanks, Seth Run ("C:\Program Files\Microsoft Office\OFFICE11\Outlook.exe /select outlook:calendar") WinWaitActive ("Calendar - ", "") ;none of the functions below seem to work ;Send ("!f") ;ControlFocus ("Calendar - ", "Microsoft Outlook", "NetUIHWND1" ) ;ControlClick ("Calendar - ", "Microsoft Outlook", "MsoCommandBar1" ) ;WinMenuSelectItem ("Calendar -","","&f","Save as Web Page...") Link to comment Share on other sites More sharing options...
tutor2000 Posted July 12, 2004 Share Posted July 12, 2004 Hi - Under the File Menu in Outlook 2003 you can 'Save as Web Page' - I would like to automate this so that others can look at my calendar on a network drive or (ideally) get it ftp'd to a website for people outside my network. I've spent about 3 hours trying a variety of approaches. My VBA is pretty weak so I thought Autoit would fill the gap but nothing seems to work. I can get autoit to open outlook in the Calendar view (using a command line switch) but I can access the appropriate menu control. Below is the syntax I've tried - much of it was commented out after it did not work. Any help would be appreciated. This is my last try for a few months on this as I can't justify spending more hours on this right now. Thanks, SethRun ("C:\Program Files\Microsoft Office\OFFICE11\Outlook.exe /select outlook:calendar")WinWaitActive ("Calendar - ", "");none of the functions below seem to work;Send ("!f");ControlFocus ("Calendar - ", "Microsoft Outlook", "NetUIHWND1" );ControlClick ("Calendar - ", "Microsoft Outlook", "MsoCommandBar1" );WinMenuSelectItem ("Calendar -","","&f","Save as Web Page...")Old fashion but can you tab to the controls you need?Rick Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm Link to comment Share on other sites More sharing options...
Guest manboak Posted July 12, 2004 Share Posted July 12, 2004 Thanks Rick - no I can't tab because the default focus is on the first calender entry, not on the menu controls. Repeated tabbing just takes me through all my appointments. Hope that makes sense. -Seth Link to comment Share on other sites More sharing options...
micor Posted July 13, 2004 Share Posted July 13, 2004 Hi. I think you should go with the WinMenuSelectItem approach. But due to the hide underlined letters feature in recent windows versions it can sometimes be tricky to see how menuitems should be called. The WinMenuSelectItem also seem to be case-sensitive, plus you have to type &File instead of just &f, it does NOT work as SEND. Let's test... First a working example. Run ("notepad") WinWaitActive ("Untitled -", "") WinMenuSelectItem ("Untitled -","","&File","Save &As...") Next a non working... Run ("notepad") WinWaitActive ("Untitled -", "") WinMenuSelectItem ("Untitled -","","&file","Save &As...") The only difference is the &file I say good luck with it. Sorry I couldn't provide a complete example, but I do not use Outlook myself. Link to comment Share on other sites More sharing options...
Valik Posted July 13, 2004 Share Posted July 13, 2004 WinMenuSelectItem() won't work with virtually any Microsoft product in general, and especially not any Office product; they use non-standard menu's. Link to comment Share on other sites More sharing options...
Doxie Posted July 13, 2004 Share Posted July 13, 2004 Have you tried:Send ("{ALTDOWN}")Send ("F")Send ("{ALTUP}")Send ("A")Don´t know if the command is correct, but you got the ideaThen its enough if the window is focused. Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Guest manboak Posted July 13, 2004 Share Posted July 13, 2004 Thanks Doxie - worked great. I ended up using the script below to export my calendar, still need to automate the ftp...but that isn't a ms product :-) Cheers, Seth Run ("C:\Program Files\Microsoft Office\Office11\Outlook.exe /select outlook:calendar") WinWaitActive ("Calendar -","") Send("{ALTDOWN}") Send("F") Send("{ALTUP}") Send("{Tab}") Send("{Tab}") Send("{Tab}") Send("{Tab}") Send("{enter}") Send("{enter}") Link to comment Share on other sites More sharing options...
tutor2000 Posted July 13, 2004 Share Posted July 13, 2004 Thanks Doxie - worked great. I ended up using the script below to export my calendar, still need to automate the ftp...but that isn't a ms product :-)Cheers, Seth Run ("C:\Program Files\Microsoft Office\Office11\Outlook.exe /select outlook:calendar")WinWaitActive ("Calendar -","")Send("{ALTDOWN}")Send("F")Send("{ALTUP}")Send("{Tab}")Send("{Tab}")Send("{Tab}")Send("{Tab}")Send("{enter}")Send("{enter}")HmmmmmI seem to recall someone asking you if you could tab?lolRick Only $2.00 with Resale Rights How to Block Better for Martial Artists and NonMartial Artistshttp://kirkhamsebooks.com/MartialArts/Bloc...tterEbook_m.htm Link to comment Share on other sites More sharing options...
emmanuel Posted July 13, 2004 Share Posted July 13, 2004 Thanks Doxie - worked great. I ended up using the script below to export my calendar, still need to automate the ftp...but that isn't a ms product :-) Cheers, Seth Run ("C:\Program Files\Microsoft Office\Office11\Outlook.exe /select outlook:calendar") WinWaitActive ("Calendar -","") Send("{ALTDOWN}") Send("F") Send("{ALTUP}") Send("{Tab}") Send("{Tab}") Send("{Tab}") Send("{Tab}") Send("{enter}") Send("{enter}")You can save a few lines. Run ("C:\Program Files\Microsoft Office\Office11\Outlook.exe /select outlook:calendar") WinWaitActive ("Calendar -","") Send("!f") Send("{Tab 4}") Send("{enter 2}") Single keys can also be repeated, e.g. Send("{DEL 4}") ;Presses the DEL key 4 times Send("{S 30}") ;Sends 30 'S' characters Send("+{TAB 4}) ;Presses SHIFT+TAB 4 timesalso sending "F" is sending shift+f, sending "f" sends only "f", so "!f" will probably work where "!F" wasn't. "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Guest manboak Posted July 15, 2004 Share Posted July 15, 2004 Thanks for the tips - works great! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now