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 8 -



Stefan
Landsberg
%hwnd do you need imho not deklarieren. by me goes anyway too without it before To deklarieren. (To late. rolf was faster)

I have with my Program again integrally of in front started and I jetz a couple ask.
beforehand first the actually status my program:
CompileMarkSeparation
Declare-Teil:
declare ping%, btn%
Proc-Teil:

Proc Ping

    declare pingdatei1$, pingdatei2$, pingstring$, ping$
    Parameters ip$
    let pingdatei1$="PINGTEST.TXT"
    let pingdatei2$="PING.BAT"
    let pingstring$="PING.EXE",ip$,">",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

Def-Teil:
DEF GetSysColor(1) !"User32","GetSysColor"
Fenster erstellen:
WindowStyle 63
WindowTitle "IP Checker"
Window @SUB(@DIV(%maxX,2),300),@SUB(@DIV(%maxY,2),250) - 600,500
SetTrueColor 1
CLS GetSysColor(15)
@CreateMultiEdit(%HWnd,"",10,50,570,-200)
btn%=@CreateButton(%HWnd,"Überprüfen",250,260,100,30)
WaitInput

in the EditBox to the User a list of IPs or its Aliase through absätze (to hardship too kommata or semikola) separated prompt.

my target is it for each this IPs a ping request To make.

How make I the best?

my idea:
whom content the editbox with @GETLINE$ in a Memory-Variable reading, and then somehow each ip in a string variable write. where a new ip anfäng recognize one Yes on whom absätzen (but How say I the the Program).

thereafter simply with eachone variable following request make:

ping variable$

if The idea well and umsetzbar is would it nice if someone me with the umsetzung help would.
if The idea not so well is, would a new idea very helpful
 
07/22/08  
 




Penguin
Tux
thanks Rolf, the Grundprinziep have I slow gerafft - clear To I it really can lasts it another while.

I trouble me straight therefore, the miene Hilfefenster too a Hilfetext get, for the time being only with "Print", thereby be I on the trouble punched, that it me of course whom Text outputs, but for whom Button not.
 


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




Rolf
Koch
How should we knoe where not works? always one kurzes example append.
 
07/22/08  
 




Penguin
Tux
Oh Yes, I forgot
CompileMarkSeparation
Declare btndlg&,dlgende%,dlg&
dlg&=Create("Window",%hwnd,"Hilfe",10,10,500,250)
btnDlg& = CreateButton(dlg&,"OK",175,150,120,30)
Print "Lorem ipsum dolor sit amet"

WhileNot dlgende%

    WaitInput

    If GetFocus(btnDlg&)

        dlgende% = 1

    EndIf



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




Rolf
Koch
Achso You want on dlg& printen? no this is you don't say so, nimm rather then again drawtext, because there kannste:
CompileMarkSeparation
Startpaint dlg&
Drawtext 1,1,"Lorem ipsum dolor sit amet"
Endpaintre>

and lies Please in the Profanhilfe then under startpaint /endpaint to, because the trouble for createdialog or createwindow is, that You there always the gedrawte Redraw must. See for %wmpaint in the HIlfe.
I plediere for lass The print and drawtext lane and learn create("text".... einzusetzen. there kannste too always beautiful by
settext variable&,"neuer text" a updating the Inhalts make.
 
07/22/08  
 




Penguin
Tux
so, thanks all The me helped having - The "Alpha-Version" of my Tools is ready.
except for The missing Hilfetexte and the Message the Erfolges, which not any more the trouble his might, missing not any more plenty. Perhaps erweitere I the whole yet circa a GUI circa arbitrary IP´s on To pingen, but since were I first on Stefans Tool .

here the (almost) finished code, the naturally immernoch The Test-IP´s contains:
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"
    Declare btndlg&,dlgende%,dlg&
    dlg&=Create("Window",%hwnd,"Hilfe",10,10,500,250)
    Startpaint dlg&
    UseFont "CANDARA",25,20,1,0,0
    TextColor RGB(0,0,0),RGB(255,255,255)
    Drawtext 1,1,"Lorem ipsum dolor sit amet"
    Endpaint
    btnDlg& = CreateButton(dlg&,"OK",175,150,120,30)

    WhileNot dlgende%

        WaitInput

        If GetFocus(btnDlg&)

            dlgende% = 1

        EndIf

    Endwhile

endif

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"
    Declare btndlg&,dlgende%,dlg&
    dlg&=Create("Window",%hwnd,"Hilfe",10,10,500,250)
    Startpaint dlg&
    UseFont "CANDARA",25,20,1,0,0
    TextColor RGB(0,0,0),RGB(255,255,255)
    Drawtext 1,1,"Lorem ipsum dolor sit amet"
    Endpaint
    btnDlg& = CreateButton(dlg&,"OK",175,150,120,30)

    WhileNot dlgende%

        WaitInput

        If GetFocus(btnDlg&)

            dlgende% = 1

        EndIf

    Endwhile

endif

Ping "www.google.dev","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"
    Declare btndlg&,dlgende%,dlg&
    dlg&=Create("Window",%hwnd,"Hilfe",10,10,500,250)
    Startpaint dlg&
    UseFont "CANDARA",25,20,1,0,0
    TextColor RGB(0,0,0),RGB(255,255,255)
    Drawtext 1,1,"Lorem ipsum dolor sit amet"
    Endpaint
    btnDlg& = CreateButton(dlg&,"OK",175,150,120,30)

    WhileNot dlgende%

        WaitInput

        If GetFocus(btnDlg&)

            dlgende% = 1

        EndIf

    Endwhile

endif

Hier Code für Meldung des Erfolgs
TextColor RGB(0,0,0),-1
UseFont "CANDARA",15,10,1,0,0
DRAWTEXT 25,120,&qu
terminate pressing tappt im dunkeln Please a arbitrary Taste" waitinput

if it Verbesserungsvorschläge gives - always since so. And if it otherwise yet Questions or ähnliches gives - asks.

means nocheinmal one Thank you all which on this Thread involved having.
 


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




Rolf
Koch
i will Yes not , that You again umbaust, there one everything something telescope could because much identical is How else Loop with
Whilenot dlgende% - The can as procedure rebuild (see under)

If you it so umständlich as now let want, then mach at least behind each
dlgende%=1 one destroywindow(dlg&)

but rather so:
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 ping$="Antwort von":Ping%=1

    WEND

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

EndProc

Proc Errorhelp

    Parameter 1: Der Text für Hauptfenster,Parameter 2: Text für Hilfenster
    Parameters typtext$,helptext$
    TextColor RGB(255,255,255),RGB(255,255,255) vorher löschen
    DRAWTEXT 25,40,"                                            "
    TextColor RGB(255,0,0),-1
    DRAWTEXT 25,40,typtext$
    Declare btndlg&,dlgende%,dlg&
    dlg&=Create("Window",%hwnd,"Hilfe",10,10,500,250)
    Startpaint dlg&
    UseFont "CANDARA",25,20,1,0,0
    TextColor RGB(0,0,0),RGB(255,255,255)
    Drawtext 1,1,helptext$
    Endpaint
    btnDlg& = CreateButton(dlg&,"OK",175,150,120,30)

    WhileNot dlgende%

        WaitInput

        If GetFocus(btnDlg&)

            dlgende% = 1

        EndIf

    Endwhile

    destroywindow(dlg&)

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
UseFont "CANDARA",25,20,1,0,0
Ping "127.0.0.1","PINGTEST.TXT","PING.BAT"

if ping%=1

    TextColor RGB(255,255,255),RGB(255,255,255) vorher löschen
    DRAWTEXT 25,40,"                                            "
    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,10,"Server Erreichbar"

else

    Errorhelp "Server nicht erreichbar!","Hilfetext Nummer 1"

endif

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

if ping%=1

    TextColor RGB(255,255,255),RGB(255,255,255) vorher löschen
    DRAWTEXT 25,40,"                                            "
    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,40,"Client Erreichbar"

else

    Errorhelp "Client nicht erreichbar!","Hilfetext Nummer 2"

endif

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

if ping%=1

    TextColor RGB(255,255,255),RGB(255,255,255) vorher löschen
    DRAWTEXT 25,40,"                                            "
    TextColor RGB(0,255,0),-1
    DRAWTEXT 25,70,"Extern Erreichbar"

else

    Errorhelp "Extern nicht erreichbar!","Hilfetext Nummer 3"

endif

Hier Code für Meldung des Erfolgs
TextColor RGB(0,0,0),-1
UseFont "CANDARA",15,10,1,0,0
DRAWTEXT 25,120,"Zum Beenden drücken Sie 
a arbitrary Taste" waitinput
 
07/22/08  
 




Penguin
Tux
Mhmm.. I let it rather as it is, because I there to some extent understand I made have.

same another question afterwards.

one can still with XProfan sure too NEN COM-Port address - or?
 


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



the depends among other things from the Helpfile ex everybody can this first of all konsultiert...

look to OpenCom.
 
07/22/08  
 




Penguin
Tux
I Have time COM association and get nothing what me with this trouble help could.
 


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




Rolf
Koch
I say you: Nimm the Example of me and building hereon moreover on. because prozedural is rather. Stell you to You want 30 Adressen anpingen and write over ands over again the same thing. here call You always only The procedure The You in the integral Yes know, because its Yes the what You sauoft under over ands over again stand have in the else instruction, on and learn correctly. thereby program.
mean me. its in the Endeffekt your code only Time, nerves, Codesparend.
 
07/22/08  
 




Penguin
Tux
If you the sagst^^

I werd me the time everything angucken and mioch report, if I whom new code have.

I Have whom code now simply first copies and stored. I go since three Meet circa 3 in that bed and be hundemüde. I Have of course already some from your code understood, but around the now row for row durchzugucken missing The pleasure.
 


OS: Win XP/Debian
XProfan 10
07/22/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.422 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