Scenario:
Button click which then runs batchPlay Code
document.getElementById('BtnTest').addEventListener('click', async () => {
await exeModal(testfunction, {
"commandName": "Please Wait" // this shows in the progress bar if displayed
});
async function testfunction(executionContext) {
let hostControl = executionContext.hostControl;
// Get an ID for a target document
let documentID = await app.activeDocument._id;
// Suspend history state on the target document
let suspensionID = await hostControl.suspendHistory({
"historyStateInfo": {
"name": "History State Message", // this show in history
"target": [{
_ref: "document",
_id: documentID
}]
}
});
/*
Do stuff here.
It can be batchPlay or any other javascript code
*/
await hostControl.resumeHistory(suspensionID);
}
});