-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmenuFileSaveAll.jsx
More file actions
69 lines (58 loc) · 1.87 KB
/
menuFileSaveAll.jsx
File metadata and controls
69 lines (58 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//DESCRIPTION:Add a Save all feature in the File Menu.
// Installation:
// Place the current file into Scripts/Startup Scripts/
// (if the folder Startup Scripts doesn't exist, create it)
/********************************************************\
Description .....: A fork of Mark Autret's FileCloseAll.js with minimal changes.
Add a Save all feature in the File Menu.
Version .........: 1.0
C.Date / M.Date .: 28.06.2025 / 29.06.2025
Target App ......: Adobe InDesign CS4+
Credits .........: www.indiscripts.com
File Encoding ...: UTF-8 no BOM
\********************************************************/
#targetengine "menuFileSaveAll"
// THE MAIN PROCESS
// -----------------------------------------------
var fcaTitle = {
cs: "Uložit vše",
de: "Alles speichern",
en: "Save All",
es: "Guardar todo",
fr: "Tout enregistrer",
it: "Salva tutto",
ru: "Сохранить все"
};
var fcaHandlers = {
'beforeDisplay': function(ev) {
ev.target.enabled = (app.documents.length > 1);
},
'onInvoke': function() {
var doc;
for (var i = 0; i < app.documents.length; i++) {
doc = app.documents[i];
if (doc.converted) {
doc.save(File(doc.filePath + '/' + doc.name));
} else {
doc.save();
}
}
}
};
// THE MENU INSTALLER
// -----------------------------------------------
var fcaMenuInstaller = fcaMenuInstaller ||
(function(mnuTitle, mnuHandlers) {
// 1. Create the script menu action
var mnuAction = app.scriptMenuActions.add(mnuTitle);
// 2. Attach the event listener
var ev;
for (ev in mnuHandlers) {
mnuAction.eventListeners.add(ev, mnuHandlers[ev]);
}
// 3. Create the menu item
var fileMenu = app.menus.item("$ID/Main").submenus.item("$ID/&File");
var refItem = fileMenu.menuItems.item("$ID/&Save");
fileMenu.menuItems.add(mnuAction, LocationOptions.after, refItem);
return true;
})(localize(fcaTitle), fcaHandlers);