Clear Screen

Clear Screen

Post by Jason Mose » Fri, 06 Feb 2004 01:56:39


Does anyone know how to clear the current user view in a dos screen
while a vbscript is running?
For instance: If a user selects an option from a menu, clear the menu
and start the clear screen with their option...

Thanks in advance....
 
 
 

Clear Screen

Post by Ray at <%s » Fri, 06 Feb 2004 02:01:34

What menu? What DOS screen? What do you mean? CLS is the clear screen
command in DOS/shell scripting. ?

Ray at work

 
 
 

Clear Screen

Post by Jason Mose » Fri, 06 Feb 2004 02:15:33


I know I can use CLS to clear a dos screen, but how do I implement that
into a vbscript? When I say menu, I mean it's just a dos echo of
options which the user just picks from.
 
 
 

Clear Screen

Post by Ray at <%s » Fri, 06 Feb 2004 02:44:44

Why don't you just use CLS then if the user is interacting with dos?

@echo off
:Select
echo Please select your option.
echo.
echo 1. Pears
echo 2. Grapes
echo 3. Doritos
echo 4. Pineapple
echo.
SET /P NumSelect=Enter number:
SET /A NumSelect=%NumSelect%
IF %NumSelect%==0 GOTO :Select
IF %NumSelect% GTR 4 GOTO :Select
echo You selected option %NumSelect%
pause
CLS

Ray at work
 
 
 

Clear Screen

Post by mr unrelia » Fri, 06 Feb 2004 03:07:06

hi Green Ninja,

Try this:

oShell.Run "%comspec% /c CLS"

cheers, jw
 
 
 

Clear Screen

Post by Richard Mu » Fri, 06 Feb 2004 03:30:55


Hi,

I tried and was unable to do it, using the WshShell object's Run and
AppActivate methods. Each ran cls (or a batch file) in another thread.

I would suggest putting your menu program in a batch file. Either run it
directly, or use the Run method to launch it from a VBScript. The program
will run in another DOS window, but you can do what you want there, then
exit and return to where ever you came from (the first DOS window or what
ever). I assume you have figured out how to accept input from the user at a
command prompt. I used to use assembly language tools for that, but there
might be better ways now.

Of course, you could display the menu selections with InputBox in VBScript,
but I assume your menu is too large.

strAns = InputBox("Select an option by number:" _
& vbCrLf & vbCrLf & "1: First" _
& vbCrLf & "2: Second" _
& vbCrLf & "3: Third", "Menu")

Wscript.Echo strAns

There are also options using the IE object in VBScript if you really want to
get fancy. If this interests you, do a Google Advanced Group search in the
scripting newsgroups, searching on "InternetExplorer.Application".

--
Richard
Microsoft MVP Scripting and ADSI
HilltopLab web site - http://www.yqcomputer.com/
 
 
 

Clear Screen

Post by MV » Fri, 06 Feb 2004 13:20:52


Script executed via cscript has no way of communicating with the command
shell that is providing the console window to ask it to execute the command
shell's *internal* CLS command. There was a very lengthy thread on this
topic a couple of years ago with a lot of people trying a lot of things, all
to no avail...


--
Michael Harris
Microsoft.MVP.Scripting

MicrosoftWindows000 Scripting Guide
http://www.yqcomputer.com/

TechNet Script Center Sample Scripts
http://www.yqcomputer.com/
Download in HTML Help format (searchable and indexed)
http://www.yqcomputer.com/

WSH 5.6 documentation download
http://www.yqcomputer.com/
 
 
 

Clear Screen

Post by Michael Sc » Fri, 06 Feb 2004 13:58:18

Here is a VERY BAD way of doing it if you must.

'Code start
wscript.echo "hello all"
dim astr, loop1, loop2
for loop1 = 1 to 25
for loop2 = 1 to 80
astr = astr & " "
next
next

wscript.echo astr
'Code end

Thank you,
Michael




command
all
> MicrosoftWindows000 Scripting Guide> > http://www.yqcomputer.com/ ; >> > TechNet Script Center Sample Scripts> > http://www.yqcomputer.com/ ; > Download in HTML Help format (searchable and indexed)> > http://www.yqcomputer.com/ ; >> > WSH 5.6 documentation download> >
http://www.yqcomputer.com/ ; >
 
 
 

Clear Screen

Post by Al Dunbar » Fri, 06 Feb 2004 15:37:21

Not as bad as:

wscript.echo "I can't clear the screen - but you can"
wscript.echo "just turn of your monitor!"


/Al






> > MicrosoftWindows000 Scripting Guide> > >
http://www.yqcomputer.com/ ; > >> > > TechNet Script Center Sample Scripts> > > http://www.yqcomputer.com/ ; > > Download in HTML Help format (searchable and indexed)> > > http://www.yqcomputer.com/ ; > >> > > WSH 5.6 documentation download> > >> >
http://www.yqcomputer.com/ ; > >> >> >