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

StartUp Script 4 CLOSE

Guest
Aug 17, 2012 Aug 17, 2012

Copy link to clipboard

Copied

Hi Friends,

I Tried the Below startup script.

#targetengine session

app.menuActions.itemByName("Close").eventListeners.add("beforeInvoke", function()

{

    //Functions

});

When I closed a Document via (shortcut -> command + w) keyboard, script executes.

But , When I closed a Document via the Close button of the Doc, nothing happens

Please advise.

Thanx in advance..........

TOPICS
Scripting

Views

813

Translate

Translate

Report

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
Community Expert ,
Aug 17, 2012 Aug 17, 2012

Copy link to clipboard

Copied

InDesign's shortcut points to the menu item, and the menu item itself is caught by your event handler. So it has the same effect, whether you press the shortcut key or select "Close" from the File menu.

The close button, on the other hand, generates a different event and does not call the actual menu item Close. I imagine a similar thing happens when you force-quit InDesign through the task manager -- not *all* events are caught by ID on the scriptable level.

I think to be able to intercept the Window close button, you need to write an actual plugin. That, or instruct your users not to use the Close button under any circumstances.

Votes

Translate

Translate

Report

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 ,
Aug 20, 2012 Aug 20, 2012

Copy link to clipboard

Copied

LATEST

This is a real problem. Maybe some knows of a plug-in that just disables the close button. That would be a great help. Telling the user not to use the close button is not enough.

Votes

Translate

Translate

Report

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 ,
Aug 17, 2012 Aug 17, 2012

Copy link to clipboard

Copied

Don't know if it's what you want, but the Application object has a "AFTER_CLOSE" event:

AFTER_CLOSEstringreadonlyDispatched after a Document is closed. This event bubbles. This event is not cancelable. (default: afterClose)

Votes

Translate

Translate

Report

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