Spell Check
Hi All,
Below code is working if spell check is not done, then it does not allow user to close the file automatically opens the document. Problem I am facing with after running spell check also it keeps opening the document.
Can any one tell me wher is the problem?
#target indesign
#targetengine "session"
var myLastDoc;
var myConfirm;
var myCheckSpellEvList = app.menuActions.item("Check Spelling...").addEventListener("beforeInvoke", myCheckSpellHandler, false);
var myBeforeCloseEvList = app.addEventListener("beforeClose", myBeforeCloseHandler, false);
var myAfterCloseEvList = app.addEventListener("afterClose", myAfterCloseHandler, false);
function myBeforeCloseHandler(myEvent)
{
myConfirm = false;
if (!eval(myEvent.parent.extractLabel("SpellingChecked")) && myEvent.parent.saved == true)
{
myLastDoc = myEvent.parent.fullName;
myConfirm = confirm("Do you want to check spelling now?", false, "You forgot to check spelling!");
}
}
function myAfterCloseHandler(myEvent)
{
if (!eval(myEvent.parent.extractLabel("SpellingChecked")))
{
if (myConfirm)
{
app.open(myLastDoc);
app.menuActions.item("Check Spelling...").invoke();
}
}
app.open(myLastDoc);
}
function myCheckSpellHandler(myEvent)
{
app.activeDocument.insertLabel("SpellingChecked", "true");
}
Regards,
Poo Del
