Thanks -Job- i managed to make it, my code is a bit messy but here it is if anyone is interested =)
import java.io.IOException;
import java.io.InputStream;
public class PingDownload {
public PingDownload() {}
public static void main(String[] args) {
int ReadCounter = 0;
int NumTotal = 0;
int LoopParameter = 0;
try {
String command = "ping www.google.co.uk";
String command2 = "cmd /c start C:\\ProgramShortcut";
while(LoopParameter != 1) {
Process child = Runtime.getRuntime().exec(command);
//Executes the command string
InputStream in = child.getInputStream();
while (ReadCounter != 169) {
int CharA = in.read();
//Reads the first character and stores its ASCII value
int CharB = in.read();
//Reads the second character and stores its ASCII value
int CharC = in.read();
//Reads the third character and stores its ASCII value
if(47<CharA && CharA<58 && ReadCounter>150) NumTotal = NumTotal + CharA;
if(47<CharB && CharB<58 && ReadCounter>150) NumTotal = NumTotal + CharB;
if(47<CharC && CharC<58 && ReadCounter>150) NumTotal = NumTotal + CharC;
//If any of the characters are numbers and the counter is near the end
//(above 150)
//add them to NumTotal this ensures only the last 3 numbers from the ping
//command are taken which are the maximum minimum and average pings
//detected
ReadCounter++; //Increment the counter
}
//When my ping is high all three numbers consist of three digits and the
//lowest
//value these can take is 0 so i know if the total is below 48x9 = 432 my ping
//is low
if(NumTotal < 432) {
child = Runtime.getRuntime().exec(command2);
LoopParameter = 1; //If the program is opened end the loop
}
}
}
catch (IOException e) {}
}
}
*cough* There might be bits wrong with it other than the way I've went about it but it worked in Netbeans and compiled ok.