Quote:
> Dear G.Born,
> I trying to use CScript to retrieve some characters. Do you have any
example
> to do this ?
Try this code:
'************************************************
' File: StdIO.vbs (WSH 2.0-sample in VBScript)
' Author: G. Born
'
' Shows how to use WSH 2.0 StdIn and Stdout
'************************************************
Option Explicit
Dim tmp, WshShell
' test, whether the host is CScript.exe
If (Not IsCScript()) Then
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "Cscript.exe " & WScript.ScriptFullName
WScript.Quit ' terminate script
End If
WScript.StdOut.WriteLine "Please enter something"
tmp = WScript.StdIn.ReadLine
WScript.StdOut.WriteLine "Your input was: " & tmp
WScript.StdOut.WriteLine "Please press Enter"
tmp = WScript.StdIn.ReadLine ' wait until key pressed
'##########################
Function IsCScript()
' check whether CScript.exe is the host
If (Instr(UCase(WScript.FullName), "CSCRIPT") <> 0) Then
IsCScript = true
Else
IsCScript = false
End if
End function
'*** End
G. Born
--
______________________________________
Check out the WSH Bazaar at www.borncity.de
Quote:
> > There is no method within WSH to do that (it makes no sense, because a
> > script doesn't has a window with a focus). You can try to write/use an
> > ActiveX control that submits Win API calls to retrieve a keyboard
state -
> or
> > you can try to use CScript in command prompt mode to read the input
> stream -
> > but these tricks are not the appropriate method you are looking for.
> > G. Born
> > --
> > ______________________________________
> > Check out the WSH Bazaar at www.borncity.de
> > > Dear Friends,
> > > I would like read some characters from keyboard. How can I do that ?
> > > Regards
> > > Jorge