-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
48 lines (38 loc) · 1.3 KB
/
index.js
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
/* 1) Create an instance of CSInterface. */
var csInterface = new CSInterface()
const loadData = async (id) => {
csInterface.evalScript('getProjectpath()', async function (path) {
const data = { id: id, location: path };
const url2 = 'http://localhost:3002/tweet'
const res = await fetch(url2, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
const data2 = await res.json();
console.log(data2);
})
};
/* 3) Write a helper function to pass instructions to the ExtendScript side. */
function openDoc() {
csInterface.evalScript('alerta()')
}
/* 2) Use a CEP method to open the server extension. */
csInterface.requestOpenExtension("com.my.localserver", "");
var openButton = document.querySelector("#import-button");
openButton.addEventListener("click", myFunction);
function myFunction() {
var x = document.getElementById("fname").value;
console.log(x)
loadData(x)
}
function getProjectPath() {
csInterface.evalScript('getProjectpath()', (result) => {
return result
})
}
/* Get the path for your panel */
var extensionDirectory = csInterface.getSystemPath("extension");