Keyboard 
Author Message
 Keyboard

Dear Friends,
I would like read some characters from keyboard. How can I do that ?

Regards
Jorge



Fri, 25 Jul 2003 04:48:19 GMT  
 Keyboard
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


Quote:
> Dear Friends,
> I would like read some characters from keyboard. How can I do that ?

> Regards
> Jorge



Fri, 25 Jul 2003 14:17:11 GMT  
 Keyboard
hi Jorge,

If you just want to get some characters or info from the keyboard into your
script, use an inputbox.

cheers, jw



Quote:
> Dear Friends,
> I would like read some characters from keyboard. How can I do that ?

> Regards
> Jorge



Sat, 26 Jul 2003 03:54:38 GMT  
 Keyboard
Dear friends,
How could I read from keyboard using WSH ?

Regards,
Jorge.



Tue, 29 Jul 2003 06:18:41 GMT  
 Keyboard
Dear G.Born,
I trying to use CScript to retrieve some characters. Do you have any example
to do this ?



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



Tue, 29 Jul 2003 06:25:29 GMT  
 Keyboard


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



Thu, 31 Jul 2003 18:02:59 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Simulate keyboard entry

2. Disable/Enable mouse and keyboard

3. how do I disable the Keyboard

4. fire keyboard events form an onclick page event

5. creating keyboard buffer events

6. Alladin Win32 Ghostscript printing without keyboard interaction

7. Ann: Example of a Macintosh typesetting keyboard

8. Stopping the user submitting a form with the keyboard

9. Getting keyboard input

10. Disabling IE Keyboard Shortcuts

11. How to start vbscripts from keyboard shortcuts?

12. Switch Keyboard Layout

 

 
Powered by phpBB® Forum Software