![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | can VBScript determine the active tab of a dialog? Wondering if I can use VBScript to determine the active tab of a dialog. Reason I'm asking is because I want to be able to run some code to change the Start Menu appearance from the Classic Start Menu (our company's default) to the XP Start Menu and then pin some shortcuts to it. I've got some code that opens the Taskbar and Start Menu Properties, and I use the SendKeys method to make the changes I want. But here's the problem: on a single PC there could be multiple users. So I was planning to either put a shortcut to this VBScript in the All Users\Startup folder, or add a reference in the registry to the HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. That way the code would run each time somebody logged in, and I'd be assured to get the correct appearance for the Start Menu no matter who's logged on to the PC. However, the problem with my solution is that when a given user logs in anytime after the first time, the SendKeys code now screws up the appearance of the menu. So ideally there would be a way to test if the "Start Menu" tab is the active tab on the "Taskbar and Start Menu Properties" dialog, or a way to determine if the "Start menu" radio button is selected, then I could build in some If/Then logic to my existing code, which looks like this: Set Shell = CreateObject("Shell.Application") Shell.TrayProperties Set Shell = Nothing Set WshShell = CreateObject("WScript.Shell") WshShell.SendKeys "+{TAB}" WshShell.SendKeys "{RIGHT}" WshShell.LogEvent( WshShell.SendKeys "{TAB 2}" WshShell.SendKeys "%s" WshShell.SendKeys "%c" WshShell.SendKeys "%e" WshShell.SendKeys "{ENTER}" WshShell.SendKeys "{ENTER}" Set WshShell = Nothing |
My System Specs![]() |
| | #2 (permalink) |
| | Re: can VBScript determine the active tab of a dialog? "Tony Logan" <TonyLogan@xxxxxx> wrote in message news:A7141D22-56AE-4013-8E16-9A505B8CC340@xxxxxx Quote: > Wondering if I can use VBScript to determine the active tab of a dialog. > Reason I'm asking is because I want to be able to run some code to change > the > Start Menu appearance from the Classic Start Menu (our company's default) > to > the XP Start Menu and then pin some shortcuts to it. > > I've got some code that opens the Taskbar and Start Menu Properties, and I > use the SendKeys method to make the changes I want. > > But here's the problem: on a single PC there could be multiple users. So I > was planning to either put a shortcut to this VBScript in the All > Users\Startup folder, or add a reference in the registry to the > HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. That way the code > would > run each time somebody logged in, and I'd be assured to get the correct > appearance for the Start Menu no matter who's logged on to the PC. > > However, the problem with my solution is that when a given user logs in > anytime after the first time, the SendKeys code now screws up the > appearance > of the menu. > > So ideally there would be a way to test if the "Start Menu" tab is the > active tab on the "Taskbar and Start Menu Properties" dialog, or a way to > determine if the "Start menu" radio button is selected, then I could build > in > some If/Then logic to my existing code, which looks like this: > > Set Shell = CreateObject("Shell.Application") > Shell.TrayProperties > Set Shell = Nothing > > Set WshShell = CreateObject("WScript.Shell") > WshShell.SendKeys "+{TAB}" > WshShell.SendKeys "{RIGHT}" > WshShell.LogEvent( > WshShell.SendKeys "{TAB 2}" > WshShell.SendKeys "%s" > WshShell.SendKeys "%c" > WshShell.SendKeys "%e" > WshShell.SendKeys "{ENTER}" > WshShell.SendKeys "{ENTER}" > Set WshShell = Nothing use it are inherently unstable because the Sendkeys method can get derailed for many reasons, most of which are unpredictable. If you want your PCs to use the Windows XP start menu style then you must locate the registry key that dermines this mode. Using Sendkeys is a waste of time. |
My System Specs![]() |
| | #3 (permalink) |
| | Re: can VBScript determine the active tab of a dialog? "Pegasus [MVP]" wrote: Quote: > The Sendkeys method should only be used as a very last resort. Scripts that > use it are inherently unstable because the Sendkeys method can get derailed > for many reasons, most of which are unpredictable. > > If you want your PCs to use the Windows XP start menu style then you must > locate the registry key that dermines this mode. Using Sendkeys is a waste > of time. > I've isolated the reg keys that will make the change, but the problem with that method is that I have to log off the user and reboot the PC in order for the changes to take effect and actually change the appearance of the Start Menu, which isn't an acceptable solution. So I think I'll recommend sticking with the Classic Start Menu, and just adding some requested shortcuts on the user's desktops and possibly in Start\Programs as an alternate solution. So, just out of curiousity, can VBScript be used to determine what items (tabs, radio buttons, etc.) are selected in a dialog, or is that more of a Visual Basic thing? |
My System Specs![]() |
| | #4 (permalink) |
| | Re: can VBScript determine the active tab of a dialog? On May 12, 11:40*am, Tony Logan <TonyLo...@xxxxxx> wrote: Quote: > "Pegasus [MVP]" wrote: Quote: > > The Sendkeys method should only be used as a very last resort. Scripts that > > use it are inherently unstable because the Sendkeys method can get derailed > > for many reasons, most of which are unpredictable. Quote: > > If you want your PCs to use the Windows XP start menu style then you must > > locate the registry key that dermines this mode. Using Sendkeys is a waste > > of time. > Thanks, Pegasus. Guess the users aren't getting the XP Start Menu then...:-) > > I've isolated the reg keys that will make the change, but the problem with > that method is that I have to log off the user and reboot the PC in orderfor > the changes to take effect and actually change the appearance of the Start > Menu, which isn't an acceptable solution. So I think I'll recommend sticking > with the Classic Start Menu, and just adding some requested shortcuts on the > user's desktops and possibly in Start\Programs as an alternate solution. > > So, just out of curiousity, can VBScript be used to determine what items > (tabs, radio buttons, etc.) are selected in a dialog, or is that more of a > Visual Basic thing? Using trial and error against possible candidates can make a particular dialog window the active one, but that's not really the same thing, though it can sometimes be useful. However, in this case, it would appear that more horsepower than WSH can deliver is needed. There is a free third party control - AutoItX out on the 'net that can provide the name of the tab, I think. In addition, when MS Office is on a machine, its VBA functions and objects can be highjacked by script to perform extended function, like calling the Windows API. With the right knowledge of the API, nearly anything is possible; maybe even refreshing the Taskbar properties without rebooting after altering the registry. Unfortunately, other than knowing that these things exists, I don't possess the knowledge you'd need to accomplish your current goal. Maybe more research on these subjects can turn up your solution. Tom Lavedas *********** |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| VBScript to dentify which mailboxes have forwarding active. | VB Script | |||
| how to use the Common Item Dialog from vista in VBscript | VB Script | |||
| retrieve Active cell "Name" vbscript | VB Script | |||
| How to do No hang up VBScript (nohup for VBScript) | VB Script | |||
| Copying Dialog appears over Confirm File Replace dialog | Vista General | |||