Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts

    sendkeys problem

    i have this function

    Code:
    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????

    Code:
    Set objShell = WScript.CreateObject("WScript.Shell")
    
    objShell.SendKeys "^{F2}"
    this is the code i have made in a .vbs file and it works

  • #2
    Regular Coder mic2100's Avatar
    Join Date
    Feb 2006
    Location
    Scunthorpe
    Posts
    562
    Thanks
    15
    Thanked 28 Times in 27 Posts
    i have made this piece of code as an example, it is used when in a IE window.

    sendkeys.vbs
    Code:
    Sub cmdClickMe_OnClick
    
    	option explicit
    	dim objShell
    	
    	Set objShell = WScript.CreateObject("WScript.Shell")
    	
    	WScript.Sleep 1000
    	
    	objShell.SendKeys "{F1}"
    
    End Sub
    and...

    sendkeys.php
    Code:
    <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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •