View Full Version : sendkeys problem

06-01-2006, 12:56 PM
i have this function

function checktxt_telephone()

and i want to use the send keys function at the end of this. The send keys must output CTRL + F2, it will be used to select a phone number in a textbox and press the keys so that another program can capture the event and dial the phone number (but i don't have to worry about that)

I have been looking at WSH... but with out much luck(i can simulate the keypresses i just can't get it working in javascript..

Does any one know how i would run a windows scripting file from a javascript page????

Set objShell = WScript.CreateObject("WScript.Shell")

objShell.SendKeys "^{F2}"

this is the code i have made in a .vbs file and it works

06-01-2006, 02:47 PM
i have made this piece of code as an example, it is used when in a IE window.


Sub cmdClickMe_OnClick

option explicit
dim objShell

Set objShell = WScript.CreateObject("WScript.Shell")

WScript.Sleep 1000

objShell.SendKeys "{F1}"

End Sub



<script language="vbscript" src="sendkeys.vbs"></script>
<input type="button" name="cmdClickMe" value="Click me">

when i click on the button nothing happens, i know all this would do is open IE help but i just want a working model. If any one as any ideas as to y this is not opening the help please let me know cos i aint to good with this javascript/vbscript stuff