/* This is a command line script for sending an SMS message via NowSMS. Below, you must substitute in the address of your NowSMS server, plus a valid username and password for an account defined in the "SMS Users" list of that server. Note: This script uses the encodeURIComponent method introduced in Internet Explorer 5.5. If you are running Windows 2000 or an earlier version of Windows, you must have Internet Explorer 5.5 or later installed for this script to work. */ var NowSMSServerAddress = "http://127.0.0.1:8800"; var NowSMSUserName = "test"; var NowSMSPassword = "test"; function HTTPGET(strURL) { var strResult; try { // Create the WinHTTPRequest ActiveX Object. var WinHttpReq = new ActiveXObject("Msxml2.XMLHTTP" /* or "WinHttp.WinHttpRequest.5"*/); // Create an HTTP request. var temp = WinHttpReq.Open("GET", strURL, false); // Send the HTTP request. WinHttpReq.Send(); // Retrieve the response text. strResult = WinHttpReq.ResponseText; } catch (objError) { strResult = objError + "\n" strResult += "WinHTTP returned error: " + (objError.number & 0xFFFF).toString() + "\n\n"; strResult += objError.description; } // Return the response text. return strResult; } var strRequest; if (WScript.Arguments.Count() < 2) { WScript.Echo ("Usage: " + WScript.ScriptName + " PhoneNumber1[,PhoneNumber2,...] NowSMSURLParameter1=Value1 [NowSMSURLParameter2=Value2] [NowSMSURLParameterN=ValueN]\r\n"); WScript.Quit(); } strRequest = NowSMSServerAddress + "/?PhoneNumber=" + encodeURIComponent(WScript.Arguments(0)) + "&User=" + encodeURIComponent(NowSMSUserName) + "&password=" + encodeURIComponent(NowSMSPassword) ; for (i=1; i= 0) { var temp = strTemp.indexOf("^"); if (temp >= 0) { strTemp = strTemp.substr(0, temp) + strTemp.substr(temp+1); } } var equPos = strTemp.indexOf("="); if (equPos >= 0) { strRequest += "&"; strRequest += strTemp.substr(0,equPos+1); strRequest += encodeURIComponent(strTemp.substr(equPos+1)); } else { strRequest += "%20"; strRequest += encodeURIComponent(strTemp); } } /* WScript.Echo(strRequest); */ WScript.Echo(HTTPGET(strRequest));