Tripredacus Posted June 5, 2007 Posted June 5, 2007 (edited) I am working on a script that clears the recent documents in Windows XP. The script only works 50% of the time. Originally it was OK to work with XP Style at 1024x768. Then I had to make it work in XP Style at any resolution. And that works. Now the issue is making it work in Classic style at any resolution. I can make it work in Classic style at 1024x768 if I record a macro. What I need is a way to open a context menu on the start button and send R (Properties). After that, the rest of the script works fine. My current issue is getting this to work on a test unit running 1280x1024. Is there any UDF for getting the properties of the Start button? It is also a screen that would say "Customize Classic Start Menu". My first attempt at using this in a pure 1024x768 environment would simply use the mouse to right click, then detect which title was in the "Customize" menu, and run the appropriate script. Now I have it set to detect the display style, then go about its method of getting the Customize Start Menu screen to appear. NOTE: Classic mode will return a NULL from $MENUSTYLE, and XP mode will return a 103. The problem is with Classic mode. The current behaviour for machines using the Classic style is that it just opens the start menu. It does not close the start menu, press tab, press context key, press R. I cannot determine the cause for this. Here is the code that I have now: expandcollapse popupMsgBox(4096,"Clear Recent Docs","This program is self automated") $MENUSTYLE = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\ThemeManager","LMVersion") If $MENUSTYLE = "103" Then Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("classname=Shell_TrayWnd","") If Not WinActive("classname=Shell_TrayWnd","") Then WinActivate("classname=Shell_TrayWnd","") WinWaitActive("classname=Shell_TrayWnd","") Send("{LWINDOWN}{LWINUP}") WinWait("Start Menu","") If Not WinActive("Start Menu","") Then WinActivate("Start Menu","") WinWaitActive("Start Menu","") Send("{APPSKEY}{DOWN}{ENTER}") WinWait("Taskbar and Start Menu Properties","") If Not WinActive("Taskbar and Start Menu Properties","") Then WinActivate("Taskbar and Start Menu Properties","") WinWaitActive("Taskbar and Start Menu Properties","") Send("{TAB}{SPACE}") Sleep(1000) If Not WinActive("Customize Start Menu","") Then WinActivate("Customize Start Menu","") WinWaitActive("Customize Start Menu","") Send("{SHIFTDOWN}{TAB}{SHIFTUP}{RIGHT}{ALTDOWN}c{ALTUP}{ESC}") WinWait("Taskbar and Start Menu Properties","") If Not WinActive("Taskbar and Start Menu Properties","") Then WinActivate("Taskbar and Start Menu Properties","") WinWaitActive("Taskbar and Start Menu Properties","") Send("{ESC}") ElseIf $MENUSTYLE = "" Then Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("classname=Shell_TrayWnd","") If Not WinActive("classname=Shell_TrayWnd","") Then WinActivate("classname=Shell_TrayWnd","") Send("{LWINDOWN}{LWINUP}") WinWait("Start Menu","") If Not WinActive("Start Menu","") Then WinActivate("Start Menu","") WinWaitActive("Start Menu","") Send("{LWINDOWN}{LWINUP}") Sleep(1000) Send("{TAB}{APPSKEY}r") WinWaitActive("classname=Shell_TrayWnd","") If Not WinActive("Customize Classic Start Menu","") Then WinActivate("Customize Classic Start Menu","") WinWaitActive("Customize Classic Start Menu","") Send("{ALTDOWN}c{ALTUP}{ESC}") WinWait("Taskbar and Start Menu Properties","") If Not WinActive("Taskbar and Start Menu Properties","") Then WinActivate("Taskbar and Start Menu Properties","") WinWaitActive("Taskbar and Start Menu Properties","") Send("{ESC}") EndIf Edited June 5, 2007 by Tripredacus Twitter | MSFN | VGCollect
evilertoaster Posted June 5, 2007 Posted June 5, 2007 FileDelete(@UserProfileDir&"\recent") Works reguardless of resolution or theme, no matter what it is.
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