Skip navigation
John Hawkinson 5,514 posts
Jun 25, 2009
Currently Being Moderated

ANN: automatic dialog after background export (exportPop.jsx)

Mar 28, 2011 7:34 PM

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.");
}());
 
 
Replies
  • Currently Being Moderated
    Mar 29, 2011 12:14 AM   in reply to John Hawkinson

    Cool!

     

    Nice job.

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2011 12:41 AM   in reply to Harbs.

    Hi John,

     

    Very interesting ! Weeks ago I tried to catch events adding eventListener to backgroundTask and went into deadend. I was then sure background tasks could'nt be monitored but your script show me that indeed it is ! It opens me a lot of perspective

     

    Loic

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2011 12:58 AM   in reply to John Hawkinson

    Thanks for doing this - it works for me and removes one annoyance from CS5, that I would forget to open the window before exporting (and finding that the background export had hung, while I waited for something to happen). Now I have an immediate heads up!

     

    Thanks for sharing.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2011 8:11 AM   in reply to John Hawkinson

    re: don't make me post to indesignsecrets

     

    LOL! Well, honestly, there's a reasonable chance that it would find a wider audience there.

    Mind if I post it there, too?

     

    --david blatner

    (you can contact me directly if you want: david at indesignsecrets.com)

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2011 8:34 AM   in reply to John Hawkinson

    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)

    http://indisnip.wordpress.com/

    http://inditip.wordpress.com/

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2011 11:02 AM   in reply to Marijan Tompa

    Hmm. Nice ideas!

     

    And buttons to open the resulting files would be very cool as well!

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2011 11:27 AM   in reply to Harbs.

    Yes Harbs, it would be great to have button to open resulting PDF!

     

    But this time, real panel (not ScriptUI palette) would be better!

    Name: Background Tasks History

    Maybe ability to edit PDF Metadata (XMP), FTP Upload...

     

    Cool feature: Send email notification after export complete

     

    --

    Marijan (tomaxxi)

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2011 2:04 PM   in reply to Marijan Tompa

    I'm liking the sound of this! You're whetting my appetite!

     

    Wanna do this together?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 30, 2011 12:29 AM   in reply to John Hawkinson

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 30, 2011 1:20 AM   in reply to John Hawkinson

    Hi John I got this error message while copying the text to MS word application.....

    Copied to word.JPG

    Thanks,

    Green4ever

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 30, 2011 6:55 AM   in reply to Harbs.

    Sure Harbs!

     

    I'm in!

     

    --

    Marijan (tomaxxi)

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 30, 2011 6:58 AM   in reply to John Hawkinson

    I think document name/path would be enough.

    Also you need to check what will happen when you

    copy stuff from InDesign to Illustrator because it will use PDF for transfer.

     

    --

    Marijan (tomaxxi)

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 31, 2011 1:22 AM   in reply to John Hawkinson

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 31, 2011 1:58 AM   in reply to John Hawkinson

    This is a classic example of how something very simple becomes not so straightforward when you get into the details...

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2011 4:28 PM   in reply to John Hawkinson

    Hey John,

     

    Here is little update on our little work

    Export History UI.png

     

    --

    Marijan (tomaxxi)

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 19, 2013 5:53 AM   in reply to John Hawkinson

    Thanks John, for your work! =)

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)