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

Clean up custom menu on app close in CS4

New Here ,
Jul 20, 2011 Jul 20, 2011

Hi,

I currently have an issue which I've been banging my head against the wall for too long and would like some expert advice. I have an ExtendScript setup to run on InDesign startup and I create a custom menu when the script is initialized. What I'm finding is, after I close InDesign and "uninstall" my script (remove from startup for instance) and re-open InDesign, my custom menu is still there! What gives?

So, I started by scripting in CS5.5 and solved this lack of clean up by adding a beforeQuit event on the application and manually removed my custom menu. This works great, in CS5.5. I need to make this script CS4 compatible, and it appears there are no events/ways to handle when the application closes. My menu is not document specific, so I can't leverage document close events.

So I've boiled it down to the following code snippet that represents the problem:

#target indesign

#targetengine "MyEngine"

function setupMenu()

{

app.menus.item('$ID/Main').submenus.add('Test Menu');

}

setupMenu();

If you put the code above in a startup script, you get the menu. If you then remove the startup script, you still get the menu. I find it hard to believe that once you create a menu item in InDesign, you can't get rid of it unless you manually remove it yourself. Am I misguided/mistaken?

Ultimately, is there a way I can, when the application closes, remove any custom menu I created so that on next launch, if the script was removed, the menu is no longer present in CS4?

Thanks for any help!

TOPICS
Scripting
1.4K
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 ,
Jul 20, 2011 Jul 20, 2011

I don't know how manually are you removing custom menu but there is a scirpt given with SDK "RemoveCustomMenu.jsx" which can be run whenever need to remove custom menu.

Mac

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 ,
Jul 20, 2011 Jul 20, 2011

It is not that I don't have code to remove a custom menu, I am wondering why I need to remove it in the first place? And that aside, is there a way to do it automatically when CS4 is closed. The code I have in the 'beforeQuit' handler for CS5.5 is (works like a charm but not in CS4):

var myMenu = app.menus.item('$ID/Main').submenus.item('My Menu');

myMenu.remove();

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 ,
Jul 20, 2011 Jul 20, 2011

You might have more success installing another startup script that removes the custom menu at startup.

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 ,
Feb 24, 2015 Feb 24, 2015
LATEST

Hi,

I know this thread is REALLY old (please forgive the threadomancy), but it came up high in my search results when I was looking for a solution to this very problem. Well, I found a solution so I thought I'd post it here for posterity.

I'm using InDesign CS5.5 and I used a startup script to add a custom menu. After removing the script and restarting InDesign the menu was still visible (though unusable).

Here's how I fixed it (USE WITH CAUTION!):

I simply deleted this file:

C:\Users\[username]\AppData\Local\Adobe\InDesign\Version 7.5\en_GB\Caches\InDesign SavedData

Restarting InDesign showed the menu has gone, finally.

I hope helps someone looking for a solution to this problem.


Cheers

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