English
Forum

Ping Tool from CMD

 
- Page 1 -



Penguin
Tux
Hi,

i want me ersteinmal present. my name is Tony, i'm 15 years old and visit a six-year secondary school in Chemnitz. Since I now Sommerferien have what about me nothing moreover To do have, have I me undertaken one small Netzwerkanalysetool To write. on the Search after a einfachen Programming-Language be I on XProfan punched.

I have everything nötige gedownloaded and installs, connect have I to one Pingcode sought and I this:
declare pingstring$,ping$,ping%
********************************************************************

Proc Ping

    Parameters nic$,pingdatei1$,pingdatei2$
    let pingstring$="PING.EXE",nic$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case equ$(ping$,"Antwort von"):Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

ENDPROC

********************************************************************
Description:
it gives of course already a speedy and nice Onlineabfrage über API,
but unfortunately gives The function only 1 for Online back, if
one über one Standart DFÜ eingewählt is.
These procedure is hold only something slower but one can even DSL
(means - no DFÜ-link) or the old T-Online u.s.w inquire!!
everything with one star umrandete is important for The request
Rolf cook - Rokosoftware - Koblenz 2002
BEISPIEL
WINDOWSTYLE 31
Window 200,200-300,80
Windowtitle "Onlinstatus-check without Api"
Text Color RGB(0,0,255),-1
UseFont "TIMES NEW ROMAN",20,10,0,0,0
DRAWTEXT 40,10,"..momentum ermittele!"
HIER JETZT THE AUFRUF THE PROZEDUR:********************
PING ADRESSE,ERGEBNISDATEI,BATCHDATEI
Parameter
1.) Webadresse - a always available How www.nic.de
2.) Dateiname, in which Pingergebnis written becomes - becomes again deleted!
3.) Dateiname, circa Ping correctly aufzurufen. - becomes again deleted!
********************************************************
Text Color RGB(255,255,255),RGB(255,255,255)
DRAWTEXT 40,10,"                                "
UseFont "TIMES NEW ROMAN",25,20,1,0,0
Text Color RGB(0,0,255),-1
Ping "192.168.0.7","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    DRAWTEXT 25,10,"Erreichbar"

else

    DRAWTEXT 25,10,"Nicht erreichbar"

endif

waitinput

Diesen code have I me to my Bedürfnissen zurechtgeschnitten and it sees How follows from. moreover should I The of me ausgedachte Funktionsweise explain.

its planned, I one Tool write, which possible simply a first Help for schoolboy and teacher bid. notice one User the it none Internetzugang has, lead it the Tool from, which the row to first whom Server anpingt, then a others Client the network and then yet a computer of outside (z.B. Date). If it with of/ one the steps no feedback gives, should a Message with hints to removal on the Bildschrim attend.

now to that code:
declare pingstring$,ping$,ping%

Proc Ping

    Parameters nic$,pingdatei1$,pingdatei2$
    let pingstring$="PING.EXE",nic$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case equ$(ping$,"Antwort von"):Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

ENDPROC

WINDOWSTYLE 31
Window 200,200-500,80
Windowtitle "Onlinstatus-check without Api"
Text Color RGB(0,0,255),-1
UseFont "TIMES NEW ROMAN",20,10,0,0,0
DRAWTEXT 40,10,"..momentum ermittele!"
Text Color RGB(255,255,255),RGB(255,255,255)
DRAWTEXT 40,10,"                                "
UseFont "CANDARA",25,20,1,0,0
Ping "127.0.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    Text Color RGB(0,255,0),-1
    DRAWTEXT 25,10,"Server Erreichbar"

else

    Text Color RGB(255,0,0),-1
    DRAWTEXT 25,10,"Server not erreichbar"

endif

Ping "192.168.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    Text Color RGB(0,255,0),-1
    DRAWTEXT 25,10,"Client Erreichbar"

else

    Text Color RGB(255,0,0),-1
    DRAWTEXT 25,10,"Client not erreichbar"

endif

Ping "www.google.de","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    Text Color RGB(0,255,0),-1
    DRAWTEXT 25,10,"Google Erreichbar"

else

    Text Color RGB(255,0,0),-1
    DRAWTEXT 25,10,"Google not erreichbar"

endif

waitinput

One trouble, which itself to Time auftut, is the fact the the Fensterinhalt not gelöcht becomes. that is the "Server Erreichbar", "Client Erreichbar" and "Google Erreichbar" übereinander written go, means need I a Possibility whom Content the Fensters to each step To delete. thereby be on

punched. Nutze I these Possibility to or. to "Server Erreichbar" becomes "Server Erreichbar" none displayed.

for a small Hilfestellung would I very grateful.

thanks
Tony
 


OS: Win XP/Debian
XProfan 10
07/20/08  
 



 
- Page 2 -



Stefan
Landsberg
super thanks,
but the second warning comes still.

should The variable status$ because absolutely a number include or what wants me The warning say?

further plans:
the whole so strain that several ips indicated go can
(possible too ip lists)
the design adorn!!!
 
07/20/08  
 




Penguin
Tux
after the Grundgerüst of my Tools standing, would like I now a manner Tipbox to one fehlgeschlagenen step insert. should means hot, that one Febster with hints to removal the Fehlers appear. the I get certainly best with the "Dialog gestalten"-point there. The dialog but should only attend if "X not Erreichbar" is, means a if- or if/hardship-function. so come I though not integrally clear.

The code yet:
CompileMarkSeparation
declare pingstring$,ping$,ping%

Proc Ping

    Parameters nic$,pingdatei1$,pingdatei2$
    let pingstring$="PING.EXE",nic$,">",pingdatei1$
    Assign #6,pingdatei2$
    Rewrite #6
    Print #6,pingstring$
    Close #6
    WinExecwait(pingdatei2$,0)
    Assign #5,pingdatei2$
    Erase #5
    ASSIGN #3,pingdatei1$
    RESET #3
    Ping%=0

    WHILENOT EOF(#3)

        input #3,ping$
        ping$=mid$(ping$,1,11)
        case equ$(ping$,"Antwort von"):Ping%=1

    WEND

    CLOSE #3
    Assign #1,pingdatei1$
    Erase #1

EndProc

WINDOWSTYLE 31
Window 200,200-500,180
Windowtitle "PiRePro by penguin"
TextColor RGB(0,0,255),-1
UseFont "TIMES NEW ROMAN",20,10,0,0,0
DRAWTEXT 40,10,"..moment ermittele!"
TextColor RGB(255,255,255),RGB(255,255,255)
DRAWTEXT 40,10,"                                "
UseFont "CANDARA",25,20,1,0,0
Ping "127.0.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,10,"Server Erreichbar"

else

    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,10,"Server Nicht erreichbar"

endif

Hier Code für Fehlermeldung/Tipbox
Ping "192.168.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,40,"Client Erreichbar"

else

    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,40,"Client Nicht erreichbar"

endif

Hier Code für Fehlermeldung/Tipbox
Ping "www.google.de","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,70,"Extern Erreichbar"

else

    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,70,"Extern Nicht erreichbar"

endif

Hier Code für Fehlermeldung/Tipbox
Hier Code für Meldung des Erfolgs
TextColor RGB(0,0,0),-1
UseFont "CANDARA",10,10,1,0,0
DRAWTEXT 25,120,"Zum Beenden drücken Sie bitte eine beliebige Taste"
n> waitinput

One further Poblem exists in the spending the Dialogs to verification the fehlerlosen Search, this should to "Zum terminate pressing tappt im dunkeln Please a arbitrary Taste" attend and by a manner "OK" Button lane To clicking his.

thanks
Tony
 


OS: Win XP/Debian
XProfan 10
07/20/08  
 




Jörg
Sellmeyer

CompileMarkSeparation
MessageBox(ip$"   -   "status$,Status,0640262144)
>

here must Pluszeichen mere, How Paul already written has, and status mus in quotation marks written go.
 
Windows XP SP2 XProfan X4
... und hier mal was ganz anderes als Profan ...
07/20/08  
 




Stefan
Landsberg
@jörg
that with the pluszeichen I had made and has too super worked but I Have forget with the second parameter of messagebox the status in quotation marks To settle.

The row causes now no warning More and sees so from:
CompileMarkSeparation
MessageBox(ip$ + "   -   " + status$,"Status",0640262144)
>

@tony
i'd to each ping commands first a row How
CompileMarkSeparation
let ping_1%=ping%
>

write. then can you hereafter for each request particular inquire whether tappt im dunkeln successful was or not.

and latterly can you then once a infotext make:
CompileMarkSeparation
the print is jetz The fastest method. can naturally too one window style.
How the goes white I but not yet
 
07/20/08  
 



Stefan Löwen
window style.
How the goes white I but not yet


Look you time CreateText  on.
 
07/20/08  
 




Penguin
Tux
thanks Stefan, I werd the time try. beforehand another question.

what bewirkt
CompileMarkSeparation
let ping_1%=ping%
>

?
 


OS: Win XP/Debian
XProfan 10
07/20/08  
 




Stefan
Landsberg
I thought me the so, that You first The whole ping inquire make, and latterly once screen, whether a the inquire negative was. For this do you need but the ergebnisse all 3 inquire.
to the first ping request is the variable ping% according to Result 1 or 0

if You jetz but the next ping request make becomes ping% by the Result these request überschrieben. and "let ping_1%=ping%" secure You whom worth of ping% to ping_1%.

to the second request must the then naturally
"let ping_2%=ping%"
hot, and to the third
"let ping_3%=ping%"

then can you latterly The three variables ping_1%, ping_2% and ping_3% inquire and know which request negative and which positively was.
therefore can you then a suitable hilfetext to feature

The three variables must You naturally yet integrally supra into declare part write.
 
07/20/08  
 




Penguin
Tux
means in the Endeffekt so:
CompileMarkSeparation
Ping "127.0.0.1","PINGTEST.TXT","PING.BAT"

if equ(ping%,1)

    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,10,"Server Erreichbar"

else

    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,10,"Server Nicht erreichbar"
    let ping_1%=ping%

CompileMarkSeparation
declare pingstring$,ping$,ping%,ping_1%=ping%,ping_2%=ping%,ping_3%=ping%
 


OS: Win XP/Debian
XProfan 10
07/20/08  
 




Rolf
Koch
and think on it, that my code very old is and correct go can.
to that example can everywhere the LET lane. Or inquire
instead of
CompileMarkSeparation
if equ$(blabla$="irgendwas")re>
rather then
CompileMarkSeparation
if blabla$="irgendwas"re>

to that previous Posting of Stefan:
yet rather is it naturally one aray To take:
CompileMarkSeparation
declare ping%[3]
>

and then The Zuweisung:
CompileMarkSeparation
ping%[1]=......
>

CompileMarkSeparation
ping%[2]=......
>

CompileMarkSeparation
ping%[3]=......
>
 
07/20/08  
 




Stefan
Landsberg
almost.
so How You the made have would the
let ping_1%=ping%
commands only carryed out go if the server Not Available is.

I mean the so:
CompileMarkSeparation
Ping "127.0.0.1","PINGTEST.TXT","PING.BAT"
let ping_1%=ping%

if equ(ping%,1)

    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,10,"Server Erreichbar"

else

    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,10,"Server Nicht erreichbar"

CompileMarkSeparation
declare pingstring$, ping$, ping%, ping_1%, ping_2%, ping_3%

@rolf
it can his that the code very old is. but it functions and the counts by me.
 
07/20/08  
 




Penguin
Tux
Stefan Löwen
almost.
so How You the made have would the
let ping_1%=ping%
commands only carryed out go if the server Not Available is.

I mean the so:
CompileMarkSeparation
Ping "127.0.0.1","PINGTEST.TXT","PING.BAT"
let ping_1%=ping%

if equ(ping%,1)

    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,10,"Server Erreichbar"

else

    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,10,"Server Nicht erreichbar"

CompileMarkSeparation
declare pingstring$, ping$, ping%, ping_1%, ping_2%, ping_3%


well clear, there had myself on it komemn can, can Yes nothing go, if I it to "else" write.

and the Error in the Declarezeile had I never found, thanks!
CompileMarkSeparation
and the write I then end to "waitinout"?
 


OS: Win XP/Debian
XProfan 10
07/20/08  
 




Stefan
Landsberg
@iF
I have me createtext angeguckt. but I white not so correctly. I so begin should.

understand I the right, I the as substitute for my messagebox use should?

with the the lever the übergeordneten fensters ferstehe I do not integrally. what must I there as lever hinschreiben?

I Have it time with this row probiert:
CompileMarkSeparation
Createtext(%hWnd,ip$ + "   -   " + status$,0,0,200,200)
>

but the row causes quite nothing.

@tony
hm,
ne I mean behind the waitinPut would the rather aufgehoben.
then becomes namely first your screen with the ergebnissen displayed.
and if one then a Key pressing appear the infotext.

as anregung for your Program:
- The font in the ergebnisfenster is quite langgezogen.can Perhaps Change.
- super would it too yet if The font ruddy would if The IP Not Available is.
 
07/20/08  
 




Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

24.381 Views

Untitledvor 0 min.
Georg Teles08/01/23
Thomas Freier10/06/22
Langer01/30/21
Walter01/29/19
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie