Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > alt.comp.lang.vbscript > #35

Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ?

From Paul <nospam@needed.invalid>
Newsgroups alt.comp.lang.vbscript, alt.comp.os.windows-xp, alt.windows7.general
Subject Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ?
Date 2025-12-13 16:55 -0500
Organization A noiseless patient Spider
Message-ID <10hkndd$f0eu$1@dont-email.me> (permalink)
References <10gcoac$2l8do$1@dont-email.me> <10hk0bk$5c2m$2@toylet.eternal-september.org> <10hk5i8$7mqo$1@dont-email.me>

Cross-posted to 3 groups.

Show all headers | View raw


On Sat, 12/13/2025 11:51 AM, R.Wieser wrote:
> Mr. Man-wai Chang,
> 
>> https://www.google.com/search?q=vbscript+OpenTextFile+CreateTextFile+console{snip}
> 
> [quote=me]
> I can't get  those to work using OpenTextFile / CreateTextFile.
> [/quote]
> 
> And yes, I did search for the solution before posting here.  Alas, no dice.
> 
> Regards,
> Rudy Wieser
> 
> 

I asked CoPilot to write me something.

   Prepare a  vbscript CSCRIPT program which opens a window,
   accepts text input from the terminal session, then displays
   "You typed " followed by the text string, placing the text
   string on CONOUT and within the opened window, then waits
   for an additional carriage return to exit the program.

This is the resulting program.

*********************************************************
' Save this as input_echo.vbs
' Run with: cscript //nologo input_echo.vbs

Option Explicit

Dim WshShell, userInput, dummy

Set WshShell = CreateObject("WScript.Shell")

' Prompt for input from terminal
WScript.StdOut.Write "Type something: "
userInput = WScript.StdIn.ReadLine

' Echo to console
WScript.StdOut.WriteLine "You typed " & userInput

' Show in a popup window
WshShell.Popup "You typed " & userInput, 0, "Input Echo", 64

' Wait for carriage return before exit
WScript.StdOut.Write "Press ENTER to exit..."
dummy = WScript.StdIn.ReadLine

*********************************************************

This is the console session. The program blocks on the GUI,
so the GUI has to be OK'ed out first, then you can type
some input to exit the program. Oh, well. If this was a
homework assignment, the AI would not get full marks,
and I'd just have to deliver the query again with comments
added about non-blocking I/O for the GUI part.

PS S:\> cscript //nologo input_echo.vbs
Type something: Hello
You typed Hello
Press ENTER to exit...
PS S:\>

     [Picture]  Click "Download original" to escape the advertising swamp

      https://i.postimg.cc/Nfrb67QT/cscript-input-echo.gif

  Paul

Back to alt.comp.lang.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

vbscript CSCRIPT howto : writie to screen and read from keyboard ? "R.Wieser" <address@is.invalid> - 2025-11-28 19:05 +0100
  Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2025-12-13 23:22 +0800
    Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "R.Wieser" <address@is.invalid> - 2025-12-13 17:51 +0100
      Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? Paul <nospam@needed.invalid> - 2025-12-13 16:55 -0500
        Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? Paul <nospam@needed.invalid> - 2025-12-13 17:14 -0500
          Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "R.Wieser" <address@is.invalid> - 2025-12-14 07:09 +0100
        Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "R.Wieser" <address@is.invalid> - 2025-12-14 07:04 +0100
      Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2025-12-14 16:21 +0800
        Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "R.Wieser" <address@is.invalid> - 2025-12-14 11:37 +0100
  Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? JJ <jj4public@gmail.com> - 2025-12-14 08:00 +0700
    Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "R.Wieser" <address@is.invalid> - 2025-12-14 07:28 +0100
      Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2025-12-14 16:16 +0800
        Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "R.Wieser" <address@is.invalid> - 2025-12-14 11:20 +0100
      Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? JJ <jj4public@gmail.com> - 2025-12-15 01:36 +0700
        Re: vbscript CSCRIPT howto : writie to screen and read from keyboard ? "R.Wieser" <address@is.invalid> - 2025-12-14 20:45 +0100

csiph-web