Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

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

LEGEND ,
Mar 28, 2011 Mar 28, 2011

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.");
}());

TOPICS
Scripting
15.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 08, 2014 Jan 08, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 11, 2014 Jan 11, 2014

Hi, Davey:

  Sorry for the delay, I didn't mean to let this sit for so long.

Anyhow, the debugging tells us that InDesign is doing two different exports of different type: Sangam Clipboard RTF Export and Sangam Clipboard Unicode Text Export. Again, I suspect it is a function of some other program running. If not two copies of InDesign, then InDesign and some Mystery App. So I'd suggest you try exiting everything else.

Anyhow, it's easy enough to filter them out of the script.

Right before this line:

        if (tasksPanel) { tasksPanel.visible=true; }

try adding

if (ev2.format.match(/Sangam/)) { return; }

which will cause the handler to ignore formats that contain the word "Sangam."

Note that this depends on the "ev2" being included in this line:

app.addEventListener("beforeExport", function(ev2) {

which wasn't in the original version of the script, but which we added in the debugging.

Hopfullly that's clear?

Let us know how it works!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 12, 2014 Jan 12, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 12, 2014 Jan 12, 2014

Glad it worked for you.

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.

As I said: Again, I suspect it is a function of some other program running. If not two copies of InDesign, then InDesign and some Mystery App. So not necessarily two InDesigns, but some other kind of interaction.

As for your double-crashing, yes, this (unfortunately) makes sense.

It means the crash is related to the document you had open the first time, which was somehow corrupt,

crashing InDesign. Then the next you start ID, it reopens the document from the crash-recovery version, but it turns out that version is corrupt too, so it also causes the crash. The 3rd time, ID gets smart and realizes it had tried to crash-recover the same document (unsuccessfully) and does not try again.

So this is normal behavior for this variety of crash.

I think it's even probably correct behavior.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 12, 2014 Jan 12, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 12, 2014 Jan 12, 2014

A  new user account is always a good suggestion. I had also suggested exiting all open applications.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 12, 2014 Jan 12, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 12, 2014 Jan 12, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Mar 30, 2011 Mar 30, 2011

Sure Harbs!

I'm in!

--

Marijan (tomaxxi)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 27, 2016 Apr 27, 2016

Hi John,

Thank you for this script.

Works great!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jun 23, 2016 Jun 23, 2016
LATEST

Great Script.  Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines