Basically, gets the contentSets that got created by the Create print content task. Loops through them and query the API after the results comes back , you do what you need to do in the handler function.
var metaFile = new ActiveXObject("MetadataLib.MetaFile");
metaFile.LoadFromFile (Watch.GetMetadataFilename());
var metaJob = metaFile.Job();
// TODO handle multiple content sets
for (var idx1=0; idx1 < metaJob.Count; idx1++) {
metaGroup = metaJob.Group(idx1);
Watch.log(idx1.toString(),3);
var contentsetid = metaGroup.FieldByName("_vger_contentset_id");
// Get Data Records for Data Set
var xhttp = new ActiveXObject("Microsoft.XMLHTTP");
var url = Watch.GetVariable("global.rest_base_url") + "/entity/contentsets/" + contentsetid + "/pages?detail=true";
Watch.log(url,3);
xhttp.open('GET',url,false);
xhttp.setRequestHeader('Content-Type', 'application/json');
xhttp.setRequestHeader("Authorization", Watch.GetVariable("global.rest_auth_string"));
xhttp.onreadystatechange = handlerGetDataRecord;
xhttp.send();
// Save the metadata back to file
metaFile.SaveToFile (Watch.GetMetadataFilename());
}
function handlerGetDataRecord(){
... json.responseText
.., do something here loop each contentitem
}