HTA button to sendkeys to telnet.?

Author Message
kronix1

  • Total Posts : 3
  • Scores: 0
  • Reward points : 0
  • Joined: 1/8/2012
  • Status: offline
HTA button to sendkeys to telnet.? Sunday, January 08, 2012 5:41 AM (permalink)
0
Hello, Im new using vbs and HTAs.. im want to make an HTA button that will send keys to telnet . I can make subroutine to open telnet with success.. However when I attempt to add the 'WshShell.SendKeys" or 'wscript.sleep', these functions dont work inside the HTA (It works when i make it a .vbs file).  But how to get 'WshShell.SendKeys" or 'wscript.sleep' to work inside HTA..? I hear it is not possible, but i'm sure theres a way around this.. any

suggestions on how to make a gui button to send keys to telnet.. ??
 
THANKS! - 
*********************
 
<head>
<title>SRAM SORT Test</title>
<HTA:APPLICATION
     APPLICATIONNAME="SRAM ETEST Test"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
     WINDOWSTATE="max"
>
</head>
 
<script language="VBScript">
            Sub telnet
Set WshShell = WScript.CreateObject("WScript.Shell")
 Set objShell = CreateObject("Wscript.Shell")
objShell.Run "telnet"           << Code works up to this point.
                                                
WScript.Sleep 1000
WshShell.SendKeys "o"
WshShell.SendKeys "{ENTER}"
           End Sub
</script>
 
<body>
<input type="button" value="telnet" name="run_button"  onClick="telnet">
 </body>
 
 
#1
    59cobalt

    • Total Posts : 969
    • Scores: 91
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: online
    Re:HTA button to sendkeys to telnet.? Sunday, January 08, 2012 12:17 PM (permalink)
    0
    What is the problem you're trying to solve?
     
    #2
      TNO

      • Total Posts : 2094
      • Scores: 36
      • Reward points : 0
      • Joined: 12/18/2004
      • Location: Earth
      • Status: offline
      Re:HTA button to sendkeys to telnet.? Sunday, January 08, 2012 1:09 PM (permalink)
      5
      I don't have Telnet on my system, but maybe this example will help:
       
      https://gist.github.com/1580376
      To iterate is human, to recurse divine. -- L. Peter Deutsch
       
      #3
        Hackoo

        • Total Posts : 104
        • Scores: 4
        • Reward points : 0
        • Joined: 6/25/2010
        • Status: offline
        Re:HTA button to sendkeys to telnet.? Monday, January 09, 2012 2:11 AM (permalink)
        0
        Hi Try This code and tell me if it worked for you or not
        <head>
        <title>SRAM SORT Test</title>
        <HTA:APPLICATION
        APPLICATIONNAME="SRAM ETEST Test"
        SCROLL="yes"
        SINGLEINSTANCE="yes"
        WINDOWSTATE="max"
        >
        </head>
        <script language="VBScript">
        Sub telnet
        Set WshShell = CreateObject("WScript.Shell")
        WshShell.Run "telnet"
        WshShell.AppActivate "telnet"
        Sleep 1000
        WshShell.SendKeys "o"
        WshShell.SendKeys "{ENTER}"
        End Sub

        Sub Sleep(MSecs)
        Set fso = CreateObject("Scripting.FileSystemObject")
        If Fso.FileExists("sleeper.vbs")=False Then
        Set objOutputFile = fso.CreateTextFile("sleeper.vbs", True)
        objOutputFile.Write "wscript.sleep WScript.Arguments(0)"
        objOutputFile.Close
        End If
        end sub
        </script>
        <body>
        <input type="button" value="telnet" name="run_button"  onClick="telnet">
        </body>
         
        #4
          kronix1

          • Total Posts : 3
          • Scores: 0
          • Reward points : 0
          • Joined: 1/8/2012
          • Status: offline
          Re:HTA button to sendkeys to telnet.? Saturday, January 14, 2012 7:28 AM (permalink)
          0
          Thank You !!
           This is exactly what i was looking for .
           - Regards
           
          #5

            Online Bookmarks Sharing: Share/Bookmark

            Jump to:

            Current active users

            There are 0 members and 1 guests.

            Icon Legend and Permission

            • New Messages
            • No New Messages
            • Hot Topic w/ New Messages
            • Hot Topic w/o New Messages
            • Locked w/ New Messages
            • Locked w/o New Messages
            • Read Message
            • Post New Thread
            • Reply to message
            • Post New Poll
            • Submit Vote
            • Post reward post
            • Delete my own posts
            • Delete my own threads
            • Rate post

            2000-2012 ASPPlayground.NET Forum Version 3.9