Example: Working with teJobObjects

Often when scripting with TruEdit inside InDesign or InCopy, you may want to get details about a TruEdit Job. Here are a few simple ways to get information about a checked-out job, it’s parent, it’s children, and any placed jobs (if you’re working with an InDesign layout).

Example 1: Get TruEdit details about the active document:

try {
    var teObject = app.activeDocument.teGetJobDetails();
    alert ("Object Details" + "\n" +
        "JobName = " + teObject.teJobName + "\n" +
        "JobPath = " + teObject.teJobPath + "\n" +
        "JobWorkingFileName = " + teObject.teWorkingFileName + "\n" +
        "JobWorkingFileExtension = " + teObject.teWorkingFileExtension + "\n" +
        "JobId = " + teObject.teId + "\n" +
        "JobProfileName = " + teObject.teProfileName + "\n" +
        "JobAssigneeName = " + teObject.teAssigneeName + "\n" +
        "JobWorkingFileLastModified = " + teObject.teWorkingFileLastModified + "\n" +
        "JobMediaTypeDelimitedList = " + teObject.teMediaTypeDelimitedList + "\n" +
        "JobStatusName = " + teObject.teStatusName + "\n");
} catch (err) {
    alert ("Error: " + err);
}

Example 2: Get TruEdit details about the active document’s parent job:

try {
    var teObject = app.activeDocument.teGetJobDetails();
    var teObject = teObject.teGetParentJob();
    alert ("Object Details" + "\n" +
        "JobName = " + teObject.teJobName + "\n" +
        "JobPath = " + teObject.teJobPath + "\n" +
        "JobWorkingFileName = " + teObject.teWorkingFileName + "\n" +
        "JobWorkingFileExtension = " + teObject.teWorkingFileExtension + "\n" +
        "JobId = " + teObject.teId + "\n" +
        "JobProfileName = " + teObject.teProfileName + "\n" +
        "JobAssigneeName = " + teObject.teAssigneeName + "\n" +
        "JobWorkingFileLastModified = " + teObject.teWorkingFileLastModified + "\n" +
        "JobMediaTypeDelimitedList = " + teObject.teMediaTypeDelimitedList + "\n" +
        "JobStatusName = " + teObject.teStatusName + "\n");
} catch (err) {
    alert ("Error: " + err);
}

Example 3: Get TruEdit details about the active document’s child job(s):

try {
    var teObject = app.activeDocument.teGetJobDetails();   
    var teObjects = teObject.teGetChildJobs();
    for (objectIndex=0; objectIndex < teObjects.length; objectIndex++) {
        var teObject = teObjects[objectIndex];
        alert ("Object Details" + "\n" +
            "JobName = " + teObject.teJobName + "\n" +
            "JobPath = " + teObject.teJobPath + "\n" +
            "JobWorkingFileName = " + teObject.teWorkingFileName + "\n" +
            "JobWorkingFileExtension = " + teObject.teWorkingFileExtension + "\n" +
            "JobId = " + teObject.teId + "\n" +
            "JobProfileName = " + teObject.teProfileName + "\n" +
            "JobAssigneeName = " + teObject.teAssigneeName + "\n" +
            "JobWorkingFileLastModified = " + teObject.teWorkingFileLastModified + "\n" +
            "JobMediaTypeDelimitedList = " + teObject.teMediaTypeDelimitedList + "\n" +
            "JobStatusName = " + teObject.teStatusName + "\n" +
            "JobCheckedOut = " + teObject.teCheckedOut + "\n" +
            "JobCheckedOutCurrentUser = " + teObject.teCheckedOutToCurrentUser + "\n" +
            "JobCheckedOutToName = " + teObject.teCheckedOutToName + "\n");
    }
} catch (err) {
    alert ("Error: " + err);
}

 

Example 4: Get TruEdit details about the active document’s placed job(s):

try {
    var teObject = app.activeDocument.teGetJobDetails();  
    for (objectIndex=0; objectIndex < teObjects.length; objectIndex++) {
        try {
            var teObject = teObjects[objectIndex].teGetJobDetails();
            alert ("Object Details" + "\n" +
                "JobName = " + teObject.teJobName + "\n" +
                "JobPath = " + teObject.teJobPath + "\n" +
                "JobWorkingFileName = " + teObject.teWorkingFileName + "\n" +
                "JobWorkingFileExtension = " + teObject.teWorkingFileExtension + "\n" +
                "JobId = " + teObject.teId + "\n" +
                "JobProfileName = " + teObject.teProfileName + "\n" +
                "JobAssigneeName = " + teObject.teAssigneeName + "\n" +
                "JobWorkingFileLastModified = " + teObject.teWorkingFileLastModified + "\n" +
                "JobMediaTypeDelimitedList = " + teObject.teMediaTypeDelimitedList + "\n" +
                "JobStatusName = " + teObject.teStatusName + "\n" +
                "JobCheckedOut = " + teObject.teCheckedOut + "\n" +
                "JobCheckedOutCurrentUser = " + teObject.teCheckedOutToCurrentUser + "\n" +
                "JobCheckedOutToName = " + teObject.teCheckedOutToName + "\n")
        } catch (err) {
            alert ("Error: " + err);
        }
    }
} catch (err) {
    alert ("Error: " + err);
}