Last active
September 25, 2024 11:04
-
-
Save trych/e9dceddf3e676e04e848 to your computer and use it in GitHub Desktop.
InDesign Remove Recent Items StartUp-Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#target InDesign | |
#targetengine "removeRecentItems" | |
var menuName = "Remove Recent"; | |
var removeAction = app.scriptMenuActions.add(menuName); | |
removeAction.eventListeners.add("onInvoke", removeRecentItems); | |
removeAction.eventListeners.add("beforeDisplay", recentAvailable); | |
var mainMenu = app.menus.itemByName("$ID/Main"); | |
var fileMenu = mainMenu.submenus.itemByName("$ID/FileDestinationPanel"); | |
if (fileMenu.submenus.itemByName("$ID/Open &Recent").isValid && (!fileMenu.menuItems.itemByName(menuName).isValid)) { | |
fileMenu.menuItems.add(removeAction, LocationOptions.AFTER, fileMenu.submenus.itemByName("$ID/Open &Recent")); | |
} | |
function removeRecentItems () { | |
var userOR = app.generalPreferences.openRecentLength; | |
app.generalPreferences.openRecentLength = 0; | |
app.generalPreferences.openRecentLength = userOR; | |
return; | |
} | |
function recentAvailable(event) { | |
var action = event.parent; | |
if (fileMenu.submenus.itemByName("$ID/Open &Recent").isValid) { | |
action.enabled = true; | |
} else { | |
action.enabled = false; | |
} | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adds a menu entry in InDesign's file menu to remove all items from the "Open Recent" list.
If you want to use this in InDesign, download and add the file to your startup script folder (InDesign XX -> Scripts -> startup scripts).
Restart InDesign and you should now have a menu entry available in your File menu named Remove Recent. Click it to remove the list of recently open files. The menu entry is now deactivated since there are no files left to remove, but as soon as there are new files in the list the option reactivates.
If you want to have a different name for your menu entry (matching your language for example), simply change the value of menuName from "Remove Recent" to something else.