Clean up custom menu on app close in CS4
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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();
Copy link to clipboard
Copied
You might have more success installing another startup script that removes the custom menu at startup.
Copy link to clipboard
Copied
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

