-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNOM_SingleEventToBank.js
More file actions
38 lines (30 loc) · 1.06 KB
/
NOM_SingleEventToBank.js
File metadata and controls
38 lines (30 loc) · 1.06 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
studio.menu.addMenuItem({
name: "NOM\\AddSingleEventToBank",
keySequence: "Ctrl+B",
execute: function () {
//select the event in the browers
var event = studio.window.browserCurrent();
//gets the path and sets it to the var
var eventPath = event.getPath()
// Prompt the user for the bank path
var bankPath = studio.system.getText("Enter the bank path:", "bank:/Master");
// Find the event
var event = studio.project.lookup(eventPath);
if (!event) {
studio.system.message("Event not found: " + eventPath);
return;
}
// Find the bank
var bank = studio.project.lookup(bankPath);
if (!bank) {
studio.system.message("Bank not found: " + bankPath);
return;
}
// Add the bank to the event's relationships
try {
event.relationships.banks.add(bank);
} catch (e) {
studio.system.message("Error adding bank to event: " + e.message);
}
}
});