A week or two ago, I wrote a script to pop up a dialog box after any background export, in response to the InDesign CS5 PDF export status thread. It doesn't seem like there's been feedback. I suspect it's sort of gotten lost in the noise in the general forum. So here we go again!
Don't make me post it to InDesign Secrets!
This script will automatically pop up a dialog box after every export finishes (PDF, IDML, whatever). It also makes sure that the Background Tasks window is turned on.
You can download the script from here, or just paste in what follows and save as exportPop.jsx. See How to Install InDesign Scripts for installation instructions. If you save it in the Startup Scripts folder, it will run automatically when InDesign is started. Running it a second time disables it, if for some reason it causes problems.
// exportPop.jsx -- pops up Background Tasks when you start an export
// and a modal dialog when an export finishes.
// Beta version. Please post feedback at
// http://forums.adobe.com/thread/830572
// John Hawkinson, 17 March 2011
// Save in STARTUP SCRIPTS folder to start automatically.
#targetengine session
(function() {
var
old1 = app.eventListeners.itemByName("exportPop1"),
old2 = app.eventListeners.itemByName("exportPop2");
if (old1.isValid || old2.isValid) {
if (old1.isValid) { old1.remove(); }
if (old2.isValid) { old2.remove(); }
alert("Export pop up window removed.\n"+
"Indesign will behave as normal.");
return;
}
app.addEventListener("beforeExport", function() {
var
tasksPanel = app.panels.itemByName("Background Tasks");
if (tasksPanel) { tasksPanel.visible=true; }
}).name = "exportPop1";
app.addEventListener("afterExport", function(ev1) {
var task, listener;
task = app.idleTasks.add({ name: "exportPop", sleep: 1000});
listener = task.addEventListener(IdleEvent.ON_IDLE,
function(ev2) {
listener.remove();
task.remove();
alert(ev1.format+" export complete of "
+ev1.fullName+" at "+ev1.timeStamp);
});
}).name = "exportPop2";
alert("Export pop up window installed\n"+
"Background Tasks will appear the start of an export\n"+
"and a dialog will appear after each export complete.");
}());
Great work John!
I've got idea how to enhance this script even more ![]()
You could create panel with list of finished files
with all info (path, file size, file name, etc...)
It would be great way to track finished files.
--
Marijan (tomaxxi)
Wow, you guys are really getting excited!
I thought about adding a UI and decided that it would get too complicated, and it's hard to do really solid UIs in ScriptUI and I didn' want to go mess with ActionScript/FLEX/CSXS/etc. for something that nobody actually admitted to wanting to use :-).
But I think you guys should go ahead! Seems like there's a market.
Hi John,
I used your script and it is working fine. It will give an alert message after completion of PDF export. This is nice, but when I copy some text from Indesign and pasting it into some other application like Word, ESTK... here also it gives a alert message. Actually do you want to include these cases also?
Thanks,
Green4ever
It appears not.
Under OSX, cutting and pasting to Illustrator doens't produce an export popup.
Cutting and pasting text does, with a null document: "Sangam Clipboard Unicode Text Export export complete of at Thu Mar 31 2011 01:02:35 GMT-0400."
Dragging-and-dropping objects into Firefox produces: "InDesign Snippet export complete of /private/var/folders/kN/kNzi33+jHq0d7nd2+GTGGU+++TM/-Tmp-/Cleanup%20A t%20Startup/InDesign%20Snippets/Snippet_303A4A9D5.idms at Thu Mar 31 2011 01:01:57 GMT-0400" and that is kind of awkward.
I'm not sure what a reasonable filtering case is for these. I don't want to filter out snippets and I'm not sure filtering out termporary directories is wise. Their use by people is rather uncommon, but scripts may use them...blah.
John Hawkinson wrote:
I'm not sure what a reasonable filtering case is for these. I don't want to filter out snippets and I'm not sure filtering out termporary directories is wise. Their use by people is rather uncommon, but scripts may use them...blah.
But would you really want your script to interupt execution of a script which writes to the temporary folder? I'd think not. At least I think it'd be a good idea to have your script honor the current value of app.scriptPreferences.userInteractionLevel as to not interfere with scripts that have requested it shouldn't.
Whoops, sorry for the delay. Here's a version that honors app.scriptPreferences.userInteractionLevel and also checks to make sure it is exporting either a PDF or IDML. I'd especially appreciate someone confirming this works properly for InDesign that's not US English.
// exportPop.jsx -- pops up Background Tasks when you start an export
// and a modal dialog when an export finishes.
// Beta version. Please post feedback at
// http://forums.adobe.com/thread/830572
// John Hawkinson, 17 March 2011. This revision 20 April 2011.
// $Id: f4055778c272f8d200d27f7ca7a63450dd1bdf7f $
// Save in STARTUP SCRIPTS folder to start automatically.
#targetengine session
(function() {
var
old1 = app.eventListeners.itemByName("exportPop1"),
old2 = app.eventListeners.itemByName("exportPop2"),
types = [ '$ID/InDesignMarkup', '$ID/Adobe PDF (Print)',
'$ID/Adobe PDF (Interactive)'],
i, typeFilter = {};
for (i=0; i<types.length; i++) {
typeFilter[app.translateKeyString(types[i])]=1;
}
if (old1.isValid || old2.isValid) {
if (old1.isValid) { old1.remove(); }
if (old2.isValid) { old2.remove(); }
alert("Export pop up window removed.\n"+
"Indesign will behave as normal.");
return;
}
app.addEventListener("beforeExport", function() {
var
tasksPanel = app.panels.itemByName("Background Tasks");
if (tasksPanel) { tasksPanel.visible=true; }
}).name = "exportPop1";
app.addEventListener("afterExport", function(ev1) {
var task, listener;
if (app.scriptPreferences.userInteractionLevel===
UserInteractionLevels.NEVER_INTERACT ||
!typeFilter.hasOwnProperty(ev1.format) )
{
return;
}
task = app.idleTasks.add({ name: "exportPop", sleep: 1000});
listener = task.addEventListener(IdleEvent.ON_IDLE,
function(ev2) {
listener.remove();
task.remove();
alert(ev1.format+" export complete of "
+ev1.fullName+" at "+ev1.timeStamp);
});
}).name = "exportPop2";
alert("Export pop up window installed\n"+
"Background Tasks will appear the start of an export\n"+
"and a dialog will appear after each export complete.");
}());
I'm always suspicious of app.translateKey and app.findKeyStrings, especially when the latter returns stuff with spaces.. But there doesn't seem to be a better keystring for the PDF export formats.
Incidently, ImportExportEvents and DocumentEvents have their own userInteractionLevels property. I figured it would probably be the value of the scriptPreference at the time the event was dispatched, but that doesn't seem to be the case. Any clues?
Please note, Mayhem, that since app.scriptPreferences.userInteractionLevels seems to be different in every engine, I'm not sure there is much point in this check. But it does not hurt, so there we go.
How's that CSXS extension coming, guys?
North America
Europe, Middle East and Africa
Asia Pacific