-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.htm
101 lines (90 loc) · 2.24 KB
/
main.htm
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<style></style>
<script type="module">
import METADATA from 'metadata.js';
import { spawn, fs, exepath } from '@sys';
document.$('#run').on('click', () => {
const cmd = spawn([
'cmd.exe',
'/k',
'START',
'',
'/D',
'resources',
'/W',
'scapp.exe',
'main.htm',
]);
});
document.$('#debug').on('click', () => {
const inspector = spawn([
'cmd.exe',
'/k',
'START',
'',
'/W',
'inspector.exe',
]);
const cmd = spawn([
'cmd.exe',
'/k',
'START',
'',
'/D',
'resources',
'/W',
'scapp.exe',
'main.htm',
'--debug',
]);
});
document.$('#package').on('click', async () => {
try {
await pkg();
} catch (e) {
Window.this.modal(<error caption="Error">{e}</error>);
}
});
async function pkg() {
const packfolder = spawn([
'packfolder.exe',
'resources',
`data.dat`,
'-binary',
]);
await packfolder.wait();
const params = METADATA;
const dataFilename = `data.dat`;
const packageFilename = `packaged/PikPicPASTE.exe`;
if (!fs.$stat('packaged')) {
await fs.mkdir('packaged');
}
await Window.this.scapp.assembleExe(
exepath(),
dataFilename,
packageFilename,
params
);
await fs.unlink(dataFilename);
Window.this.modal(
<info caption="Success">
Your program can be found in the folder named "packaged"!
</info>
);
}
</script>
</head>
<body>
<h1>Make sure "packfolder.exe" is here.</h1>
<h2>Also, make sure "inspector.exe" and "sciter.dll" are here.</h2>
<h3>
Then, edit "metadata.js", "icon.ico" and files in the "resources" folder
to customize your program.
</h3>
<button #run>Run</button>
<button #debug>Debug</button>
<button #package>Package</button>
</body>
</html>