|
Agreed! I did not implement this naming convention nor do I condone it. With the existing code how can I have a message box saying..."Ping successful would you like to continue" Yes or No. I am still sort of new at writing vbscripts, and new some assistance on this one. Thanks!
|
|
|
|
|
Well, you could put up a message box for every machine that comes back , but you would probably be better off just outputting a line for each result that comes back. That way, you can just walk away, let it do it's thing, and come back and look at the result:
Dim WshShell, PingResult, Target, PCName
Set WshShell = Wscript.CreateObject("Wscript.Shell")
PCName = InputBox ("User I Number","Users I number","Btest")
drivelist = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
DriveArray=Split(drivelist,",")
For I = 0 To UBound(DriveArray)
Target = PCName & DriveArray(I)
PingResult = WshShell.Run ("cmd /c ping -n 1 " & Target , 6, True)
Select Case PingResult
Case 0:
WScript.Echo "SUCCESS - " & Target
Case 1:
WScript.Echo "FAILURE - " & Target & "<<<"
End Select
Next
Run this using CSCRIPT from a CMD prompt. If you run this using WSCRIPT, the normal default, you'll get a dialog box on every ping, success or fail. But, this also makes it harder to terminate the script. You'll have to go into TaskManager to do it. Running it under CSCRIPT is just WAY more convenient:
C:\Documents and Settings\[userid]\Desktop>CSCRIPT PINGTEST.VBS
RageInTheMachine9532
|
|
|
|
|
Cool...Thanks for the Success Failure ping code! One last thing...Do you know how to use the answer function for the example below? I want to be able to continue or quit the wscript if possible. How would you code this?
Dim WshShell, PingResult, Target, PCName
Set WshShell = Wscript.CreateObject("Wscript.Shell")
PCName = InputBox ("User I Number","Users I number","BTest")
drivelist = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
DriveArray=Split(drivelist,",")
For I = 0 To UBound(DriveArray)
Target = PCName & DriveArray(I)
PingResult = WshShell.Run ("cmd /c ping -n 1 " & Target , 6, True)
Select Case PingResult
Case 0: WScript.Echo "SUCCESS - " & Target
MsgBox "Do you want to continue?", vbYesNo
End Select
Next
|
|
|
|
|
B Yac wrote:
Select Case PingResult
Case 0: WScript.Echo "SUCCESS - " & Target
MsgBox "Do you want to continue?", vbYesNo
End Select
The code should be:
.
.
.
For I = 0 To UBound(DriveArray)
Target = PCName & DriveArray(I)
PingResult = WshShell.Run ("cmd /c ping -n 1 " & Target , 6, True)
Select Case PingResult
Case 0: WScript.Echo "SUCCESS - " & Target
mbResult = MsgBox("Do you want to continue?", vbQuestion + vbYesNo)
If mbResult = vbNo Then
Exit For
End If
End Select
Next
RageInTheMachine9532
|
|
|
|
|
Greeetings,
I am attempting in VB.NET to somehow capture the network packet IIS gets before it checks for HTTP headers...
i.e. I wish to use IIS as my socket server(not create my own) and want the network packets it gets at port 80 regardless if it is an http or not.
How may I accomplish this in VB.NET ?
Thanks in advance.
incoming71
|
|
|
|
|
Check into ISAPI Filters. Warning: You'll have to P/Invoke a bunch of API calls to do this and the .NET FCL does not have anything to make this easy.
RageInTheMachine9532
|
|
|
|
|
hiiiii
i m developing an application in which i m picking pixel colors from an image and display these colors in a list box with the help of loop. can any body give me code.its urgent plz.
tc
regarfds
Tahir
|
|
|
|
|
You can use SetPixel and GetPixel its a win32 API
<br />
Public Declare Function SetPixel Lib "gdi32" Alias "SetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long<br />
<br />
Public Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long<br />
|
|
|
|
|
hiiiii
i m developing an application in which i have to create control "shape" dynamically in a loop against a button click event. can anybody give me code .its urgent plz
regards
Tahir
|
|
|
|
|
Hi there,
does anybody know if the .net framework has an utility to convert modules/classes from c# to vb.net and the other way?
i guess i read something like this somewhere, but i can't remember!
thank in advance!
Fuel2Run
|
|
|
|
|
No it doesn't. That's why there is this proliferation of translators on the 'Net.
See this Yahoo[^] search result.
RageInTheMachine9532
|
|
|
|
|
i'll take a look
thanks a lot!
cheers,
Fuel2Run
|
|
|
|
|
I want to run DOS commands thru a VB app?
I know that I can use Shell, but is there a better way?
/Jarek
|
|
|
|
|
VB6 or VB.NET???
VB6, use Shell...
VB.NET, use Shell or the Process class:
Dim startInfo As New ProcessStartInfo("IExplore.exe")
startInfo.WindowStyle = ProcessWindowStyle.Minimized
startInfo.Arguments = "www.northwindtraders.com"
Process.Start(startInfo)
RageInTheMachine9532
|
|
|
|
|
Its in VB6, I can't get it to work properly?
this is my test code, this code actualy openes upp 3 cmd's and show the dir in the last one?
I only want one cmd and be able to run different commands in it!
There is a second problem cmd only works in W2K, NT and XP but not in WIN95-98, there got to be a way to run commands?
<br />
Shell "cmd", 1 <br />
SendKeys "dir c:\ *.txt" + Chr(13), True<br />
|
|
|
|
|
Where to start...
OK. There are 2 command prompt shells in WinNT and above, CMD and COMMAND. 95/98 only has COMMAND.
Now, what you want to do by stuffing the keystrokes using SendKeys is problematic at best. This is because there is no facility to make sure that, when you start the command shell, that window retains the input focus. Another window can steal the focus or the user can click in a different window. On top of that, what if the user accidentally types something in the command window your launched?
I would HIGHLY recommend looking into the Win32 Console API's, especially if you want to keep reusing the same command windows. This way, you don't have to worry about Windows versioning problems either. The docs for the Console start here[^]. A word of warning though, the documentation is written for C++ and not VB.
RageInTheMachine9532
|
|
|
|
|
Thank you!
I am a C++ programmer I know the console API.
In STL C++ you can use system function but not in VB
It amazes me that there is no other way to run console commands in VB?
/Jarek
As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality.
Albert Einstein
|
|
|
|
|
VB6 didn't really have a console available to it. VB.NET has much better support. If all you want to do is launch other programs, use the Shell, but your Shell command can also include it's command line parameters. You don't have to stuff them in with SendKeys...
RageInTheMachine9532
|
|
|
|
|
hello
i just want to know
to convert a program from VB6 to VB.net
require what prerequisite??
or is it just mearly a similiar program (can use VB6 code in VB.Net)
can please tell me what is the main different between this 2
cause i have to change my program from VB6 to VB.Net
and i have no knowledge on what VB.Net look like
please tell me and if can plese inculde some sample
thank you
Gary
|
|
|
|
|
You could just open the project (the .vbp file) using the Visual Studio.NET. This will automatically invoke the VB Upgrade Wizard and translate the code for you. Of course, it won't translate everything, but it will tell you what you need to do.
RageInTheMachine9532
|
|
|
|
|
here are a few things to look at
from MS
http://tinyurl.com/2rnq7
http://tinyurl.com/nz9v
and here is an excellent series of 15 lectures:
http://www.lakeforest.edu/~hummel/webcasts.htm
the audio webcasts are accessed thru this part of
that site
"Audio broadcasts should be available from here"
|
|
|
|
|
Hi there...
I need to produce a "star Gate" type warp effect. It doesnt have to be very large say 256 X 256. Only has to last up to 10 seconds.
Any idea where I might start using NB.Net ?
Any suggestions would be great.
Many thanks.
Coops.
|
|
|
|
|
|
Im trying to code a crystal report which gets the information from a dataset, I have the C# code to bind the data but i need the vb code, or if anyone knows of a good example on the net that might help.
Thanks,
Colum
private void Page_Load(object sender, System.EventArgs e)
{
CrystalReport1 report=new CrystalReport1();
CrystalReportViewer1.Visible=true;
DataSet ds=new DataSet("Account");//give same name as on
//dataset1 table header
DataTable table=new DataTable("Account");//give same name as on
//dataset1 table header
table.Columns.Add("Fname",typeof(System.String));
table.Columns.Add("Lname",typeof(System.String));
table.Columns.Add("Salary",typeof(System.String));
DataRow row=table.NewRow();
row["Fname"]="Mathew";
row["Lname"]="Hayden";
row["Salary"]="5000$";
// add to table
table.Rows.Add(row);
ds.Tables.Add(table);
// set report's dataset
report.SetDataSource(ds);
// set report source
CrystalReportViewer1.ReportSource =report;
}
|
|
|
|
|
Well, I'd normally say just run it through one of the C#/VB.NET code translators on the 'Net, but you have an object in that code snippet that doesn't exist in the Page_Load function, 'table'.
See this Yahoo search[^] for a list of translators.
RageInTheMachine9532
|
|
|
|
|