Skip navigation
John Hawkinson 5,572 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:
  • Currently Being Moderated
    Jan 8, 2014 5:38 AM   in reply to Ville Järvensivu

    Hello,

    First of all, Thanks John for this great script. It fits my work method perfectly!

     

    Now,

    Although I should have posted this question here first, This is the 3rd place posting it... hoping to find someone that can help!

     

    Recently something very funny started happening in my InDesign (Mac OS 10.8 - InDesign CS6 8.01)

    Everytime I copy text the backround task panel opens up like this:

    Screen Shot 2013-12-31 at 8.07.05 PM.png

     

    It happens when copying using Cmd+C and when using context menu

     

    After a little digging I found that when I disable the exportpop script, I stopped getting the task panel!

     

    However:

    1) I've been using this script for a while now and never had this problem.

    2) Why should copying be considered like exporting?????

     

     

    If anyone can shed light on this topic, I'd really appreciate it

     

    Thanks

    Davey

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 8, 2014 8:20 PM   in reply to John Hawkinson

    Hi John - Thanks for your reply!

    I have no clue what might have changed - No upgrades done (and no spyware either )

    I am not running multiple versions of InDesign

    I trashed my prefs using both methods - keyCombo and manual deleting files

     

    Regarding for your debug-coding, here is what came up

    First of all, I get 2 messages... maybe this is some clue?

     

    With code #1:

    Screen Shot 2014-01-08 at 3.27.13 PM.pngScreen Shot 2014-01-08 at 3.26.47 PM.png

     

     

     

    With Code #2:

    Screen Shot 2014-01-08 at 11.15.38 PM.pngScreen Shot 2014-01-08 at 11.15.44 PM.png

     

     

     

    I dont really understand what is going on... but maybe (hopefully) you do!

     

    Thanks for your help - and for the script

    All the best,

    Davey

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 12, 2014 7:22 AM   in reply to John Hawkinson

    Hi John

    Thanks again for your help! - Greatly appreciated.

     

    Your added code to filter out the exporting worked great.

    Regarding the issue in general, I dont have more than one InDeisgn on my computer, so how can it be running 2? I checked the "Activity Monitor" and it only shows one.

    However, I had a few crashes recently, and I saw a very wierd thing which can point to such a direction:

    • InDi crashes
    • asks if to reopen
    • I choose yes
    • right away it crashes again!
    • Asks for reopen
    • I choose yes
    • everything opens nicely!! ???

     

    I have no clue what this means... does this make any sense to anyone else?

    Could it be that there is a different thing which can cause InDi to read things twice or something like that?

     

     

    Thanks!

    Davey

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 12, 2014 9:25 AM   in reply to John Hawkinson

    Thanks a lot John.

    I understand what your suspection is now

    I also understand the crash problem - I guess I just never saw it before.

     

    I would like to troubleshoot this issue

    Do you have any tips in how to troubleshoot this?

    I guess trying with a new user account would be a start?

     

    Thanks again

    Davey

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 12, 2014 9:31 AM   in reply to John Hawkinson

    Sorry, I had forgotten to mention that I had tried that

    I closed all apps and opened indi - not corrected.

    I restarted the computer and didnt open anything except indi - also didnt help.

     

    Thats why I jumped to a new user

     

    Thanks for your help!

    Davey

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 12, 2014 11:52 AM   in reply to John Hawkinson

    Hi John

    I tried in a new user and the problem did not occur

    So, as you correctly suspected, it is a 3rd party interference... or maybe an InDesign setting...

     

    If anyone has any clue what can cause this, I would appreciate it

    But, thanks to Johns filter, it is not desperate.

     

    Thanks

    Davey

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)