Re: readLine method help



I really appreciate your help... What you suggested worked. My only remaining
question is this... Is there a way to make the cmd execution window not
appear as the script is running, or to minimize it? Because the script is
using nslookup, a cmd prompt flashes each time the command is executed. Is
there a way to make it so the window doesn't open?

"Torgeir Bakken (MVP)" wrote:

> Kendoh wrote:
>
> > Now I have this problem... I am trying to get all computers of a subnet into
> > a txt file. Here is the code. I am not getting any output... When I use your
> > code without the if loop, it writes localhost into the document... What am I
> > doing wrong?
> >
> > dim fso, fl, count
> > count = 1
> > ip = 1
> > Set fso = CreateObject("Scripting.FileSystemObject")
> > Set fl = fso.CreateTextFile("C:\\Temp\Test.txt", true)
> >
> > if count <> 256 Then
> > Set objShell = CreateObject("WScript.Shell")
> > Set objWshScriptExec = objShell.Exec("nslookup 158.187.145.&count&")
> > (snip)
> Hi,
>
> You are trying to use nslookup against 158.187.145.&count&.
> You will need to put the count variable outside the quoted string.
>
> Change
> ("nslookup 158.187.145.&count&")
> to
> ("nslookup 158.187.145." & count)
>
> and see if it helps.
>
>
> I assume you are going to make a loop eventually, so you should also
> "reset" the strName variable inside the loop to avoid inheriting
> previous value if the 'If Left(strLine, 5) = "Name:" Then' test doesn't
> kick in.
>
> So change
>
> Set objStdOut = objWshScriptExec.StdOut
>
> Do Until objStdOut.AtEndOfStream
>
>
> to
>
> Set objStdOut = objWshScriptExec.StdOut
>
> strName = ""
> Do Until objStdOut.AtEndOfStream
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx
>
.



Relevant Pages

  • Re: readLine method help
    ... Is there a way to make the cmd execution window not appear as the script is running, ... In the post in the link below there is a VBScript function NSlookup ... that uses the Run method to hide the command prompt NSlookup.exe is ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)
  • Re: How to make Internet Explorer window top most?
    ... > How to place Internet Explorer on top(modal window). ... You could set a title, and use AppActivate on it, an example here: ... You should add an "WScript.Sleep 100 in this loop to avoid CPU hogging. ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windows.server.scripting)
  • Re: readLine method help
    ... When I use your code without the if loop, it writes localhost into the document... ... dim fso, fl, count ... torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.scripting.vbscript)
  • Re: Sleep until any keystroke
    ... SAPIEN Technologies - Scripting, Simplified.www.SAPIEN.com ... VBScript & Windows PowerShell Training -www.ScriptingTraining.com/classes.asp ... Within the loop, insert the Do While stdin example. ... I think by design that ReadLine for STDIN will sit and wait forever. ...
    (microsoft.public.scripting.vbscript)
  • Re: error Name redefined for Const value
    ... > Is there a better way to declare the variable? ... You can never define a Const inside a loop, ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
    (microsoft.public.windows.server.scripting)

Loading