I think if you use app.open("FileObject") instead of execute, it will automatically wait.
var file1 = File.openDialog(); var myDoc = app.open(file1); alert("Now");
The alert "Now" should not come up before the document is open
[At least thats what happened when I tried it]
Many Thanks that worked fine.
However some pages have missing Fonts and therefore the script cannot proceed because there is a modal dialog or alert is active.
Is there a way to surpress this in the script, so that the script can close any modal dialog box or alert and carry on?
var file1 = File.openDialog();
var myDoc = app.open(file1);
close any alerts or modal dialog boxes if there is
@Mark – you could try setting the userInteractionLevel of the scriptPreference:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
Don't forget to reset it at the end to: UserInteractionLevels.INTERACT_WITH_ALL.
See DOM documentation online here:
Or get the CHM files for offline use and better searchability here: