Results 1 to 4 of 4

Thread: HTA Application

  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HTA Application

    Hi,

    We have a requirement to send keystrokes to some of our Windows XP Pro laptops (to prevent the screen saver, set by Group Policy, from kicking in during presentations). We have easily managed this using WScript, but it isn't that user friendly. We thought we would use an HTA application instead and have this code...

    *************************
    <hta:application
    border="dialog"
    borderStyle="raised" />

    <html>

    <head>

    <SCRIPT LANGUAGE="VBSCRIPT">
    Sub SendCAPS()
    set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.SendKeys "{CAPSLOCK}"
    End Sub
    </SCRIPT>

    </HEAD>


    <body>

    <form>
    <p ALIGN="center">
    <input TYPE="button" VALUE="Run" NAME="B1" ONCLICK="SendCAPS()">
    <input TYPE="button" VALUE="Close" NAME="B2" ONCLICK="parent.close()">
    </form>

    </body>

    </html>
    *************************

    Our problem is that Windows Script Host methods must execute under Windows Script Host; with HTAs not running in the WSH environment. Thus, our SendKeys method won't work within the HTA.

    Has anyone got a scripting solution that would work within an HTA (i.e. an equivalent to the SendKeys method that isn't WSH)?

    TIA,

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: HTA Application

    I have used the FileSystemObject in an HTA, but it was so long ago that browser security restrictions might have changed things...

    One thing to try. Edit out the first WScript in the following line:

    OLD: <code>set WshShell = WScript.CreateObject("WScript.Shell")</code>
    NEW: <code>set WshShell = CreateObject("WScript.Shell")</code>

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    Renton, Washington, USA
    Posts
    12,560
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: HTA Application

    Can you change the TIME setting, if so set it for the max time you can.

    Now running HP Pavilion a6528p, with Win7 64 Bit OS.

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: HTA Application

    Thank you - that worked beautifully!

    Much appreicated,

Posting Permissions

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