emrefan
2011-01-27 09:19:56 UTC
I have a keyboard macro written in Windows Script and it was working
when I had Windows XP Professional SP2 (I have the traditional Chinese
version of XP, if that matters). After installing SP3, it stopped
working. It seems SP3 is preventing some type of keys to be sent to
applications. The following test script (NOT my original script, which
is a bit more complex) demonstrates the problem. If anyone has
Windows XP Pro + SP3, please try it out and better yet, provide a
solution / workaround.
-------------------------------------------- snip
-----------------------------------------------------------------------------------
set oShell = WScript.createObject( "WScript.Shell" )
oShell.run "notepad"
WScript.sleep 800
' Please adapt the window name in following function for your
' particular version of Windows XP:
wndFound = oShell.appActivate( "noname - notepad" )
if not wndFound then
WScript.Echo "Window not found, cannot send keys to it"
WScript.quit
end if
' Sending ctrl-o to start the Open document dialogue box does NOT
' work on XP w/ SP3:
oShell.sendKeys "^O"
WScript.sleep 100
oShell.sendKeys "sending plain text works"
--------------------------------------------- snip
---------------------------------------------------------------------
when I had Windows XP Professional SP2 (I have the traditional Chinese
version of XP, if that matters). After installing SP3, it stopped
working. It seems SP3 is preventing some type of keys to be sent to
applications. The following test script (NOT my original script, which
is a bit more complex) demonstrates the problem. If anyone has
Windows XP Pro + SP3, please try it out and better yet, provide a
solution / workaround.
-------------------------------------------- snip
-----------------------------------------------------------------------------------
set oShell = WScript.createObject( "WScript.Shell" )
oShell.run "notepad"
WScript.sleep 800
' Please adapt the window name in following function for your
' particular version of Windows XP:
wndFound = oShell.appActivate( "noname - notepad" )
if not wndFound then
WScript.Echo "Window not found, cannot send keys to it"
WScript.quit
end if
' Sending ctrl-o to start the Open document dialogue box does NOT
' work on XP w/ SP3:
oShell.sendKeys "^O"
WScript.sleep 100
oShell.sendKeys "sending plain text works"
--------------------------------------------- snip
---------------------------------------------------------------------