Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: wxPing
1. If it was possible to retrieve text from a DOS box in Win95..
2. What command in WinBatch sends output to a text file??
3. How do I change the timeout on wxPing?
Below is a script I use to verify our servers. Just change the top two lines at first.
The ping wait time is set to default to about 15 seconds.
The wxParmSet function may be used to set the ping timeout to a lower number.
To keep a log file...
data="stuff you want to write to the log" handle=FileOpen("C:\temp\log.txt","APPEND") FileWrite(handle,data) FileClose(handle)Now the main script:
;===================================cut============================ ;ServerCheck.wbt ipaddrs="206.63.11.254 206.63.11.48 206.63.11.10 www.windowware.com 206.63.0.254" ipwho="Router Duality Commerce Winware Dilbert" IntControl(12,9,0,0,0) Addextender("wwwsk34I.dll") ipcount=ItemCount(ipaddrs," ") downlist="" count=0 BoxTitle("Initializing") while 1 count=count+1 good=0 For xx=1 to ipcount thisip=ItemExtract(xx,ipaddrs," ") thiswho=ItemExtract(xx,ipwho," ") a=wxPing(thisip) if a==0 ;Ooop TimeDelay(5) a=wxPing(thisip) ; try again if a==0 ;Ooop TimeDelay(5) a=wxPing(thisip) ; try again if a==0 ;Ooop TimeDelay(5) a=wxPing(thisip) ; try again endif endif endif b=ItemLocate(thiswho,downlist," ") if a==0 ; Add to downlist if b==0 downlist=strcat(downlist," ",thiswho) endif BoxOpen("DOWN %count%",downlist) mmpos=MouseInfo(2) mmx=ItemExtract(1,mmpos," ") mmy=ItemExtract(2,mmpos," ") MouseMove(0,0,"","") TimeDelay(0.25) MouseMove(10,10,"","") TimeDelay(0.25) MouseMove(mmx,mmy,"","") PlayWaveForm("C:\WINDOWS\MEDIA\AFFAIR.WAV",0) else good=good+1 ; Remove from if b!=0 downlist=ItemRemove(b,downlist," ") endif endif next if good==ipcount BoxShut() BoxText("All servers operational") BoxTitle("UP %count%") TimeDelay(30) else TimeDelay(5) endif endwhileSet the ping timeout with wxParmSet.
The winbatch script sends a JCL file to the mainframe for execution using ftpQuote.
Everything works fine with a Windows NT 4.0 client but hangs (crashing the system) a Windows 95 client.
I've added a wxPing() call into the script before the ftpOpen() command. This doesn't seem to make any difference. However, I am finding that the script seems to work (more testing is needed) if I start the script with a Message() statement.
I'd like to know if anyone has any similar experiences and work arounds.
Maybe add:
TimeDelay(10)at the top of the script in place of the message, or some kind of message statement to the PowerBuilder code to see if making it wait for Winbatch to complete helps the situation.
runwait ("command.com", "/c ping.exe > ping.txt")and then you could do a file open on ping.txt to read the contents. So here's the general approach:
; Test for connection to the server the first time, when connected, start the rest RunHide("command.bat", "") SendKeysTo("~MS-DOS", "del ping.txt{ENTER}") SendKeysTo("~MS-DOS", "Ping -w 1900 159.6.54.3 > ping.txt{ENTER}") Delay(10) SendKeysTo("~MS-DOS", "exit{ENTER}") Delay(2) fping = FileOpen("ping.txt","READ") strping = " " while @TRUE x = FileRead(fping) if x == "*EOF*" Then Break strping = StrCat (strping, x) endwhile FileClose(fping) pingok = StrIndex(strping, "Reply", 1, @FWDSCAN) If pingok!=0 then goto CONNECT
Article ID: W12690
Filename: wxPing Utility.txt
File Created: 2001:03:01:15:05:06
Last Updated: 2001:03:01:15:05:06