...

View Full Version : sendkeys problem



mic2100
06-01-2006, 11:56 AM
i have this function


function checktxt_telephone()
{
document.form1.txt_telephone.focus();
document.form1.txt_telephone.select();
}

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

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

sendkeys.vbs



Sub cmdClickMe_OnClick

option explicit
dim objShell

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

WScript.Sleep 1000

objShell.SendKeys "{F1}"

End Sub



and...

sendkeys.php



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



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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum