The developer came up with another idea and is able to program the application to look at the System Variable with much more reliability. THe application needs to look a the client name that the user is connecting from as this is the only constant that doesn't change I plead my case and appeal to the guru's on MSFN to please help me solve this one!Īny help or suggestions on how to fix this would be greatly appreciated!ĮDIT: Further research has found that the Sendkeys function is not consistantly reliable by nature and is not recommended for use in certain applications such as this, so I'm using a different approach to apply the theme style.We have an in-house software that should be looking at the ViewClient_Machine_Name Value in HKEY_CURRENT_USER\Volatile Environment or if we issue a set view command but unfortunately it is pretty much hit and miss. This seems to be a simple task to automatically "press" the enter key, but making it work consistantly has been a royal pain. The only thing I can figure that may be causing the problem is the windows sendkey function isn't always available or being found when the script file runs? I've also tried using the sleep command with different timings to delay the sendkey function within the vbs with inconsistant mixed results. I've tried using cscript, Wscript, and start to call the vbs file in various cmd and bat files with the same results where they work fine alone, but not when called by another process. I have tried creating an exe file with Winrar that works fine by itself, but again, the sendkey function doesn't work when the exe file is called from RunOnceEx. However, when it is called from inside a batch, exe, or cmd file, the sendkey is intermittent and doesn't always work which requiries manually pressing the enter key to apply the theme. This script resides and is being called from C\Windows\Resources\Themes, and it runs fine by itself every time.
WshShell.AppActivate("Display Properties") Set WshShell = CreateObject("WScript.Shell")