Skip to content

Instantly share code, notes, and snippets.

@ArtemAvramenko
Created November 8, 2016 12:06
Show Gist options
  • Save ArtemAvramenko/6936595d7d7003e20a27ddd161e839e9 to your computer and use it in GitHub Desktop.
Save ArtemAvramenko/6936595d7d7003e20a27ddd161e839e9 to your computer and use it in GitHub Desktop.
// cscript waitUrl.js http://alm-build/TimeTracker/dev/test/favicon.ico
var url = WScript.Arguments(0);
var status = 0;
var WinHttpReq = new ActiveXObject('WinHttp.WinHttpRequest.5.1');
for (var i = 0; i < 30; i++) {
WScript.Sleep(1000);
WinHttpReq.Open('GET', url, false);
WinHttpReq.Send();
status = WinHttpReq.Status;
if (status == 200) {
break;
}
}
WScript.Echo('Status: ' + status);
if (status != 200) {
WScript.Quit(10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment