-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
distribution.ahk
79 lines (72 loc) · 1.43 KB
/
distribution.ahk
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
#SingleInstance Force
SetWorkingDir(A_ScriptDir)
#include meta.ahk
write_prop(vnt) {
global
try
{
_name := baseName
if(vnt > 0) {
_name .= "-VNT"
}
binaryFilename := _name ".exe"
downloadFilename := _name ".zip"
props := FileOpen("compile_prop.ahk", "w")
props.WriteLine(";@Ahk2Exe-SetName " _name)
props.WriteLine(";@Ahk2Exe-SetVersion " version)
props.WriteLine(";@Ahk2Exe-SetMainIcon iwck.ico")
props.WriteLine(";@Ahk2Exe-ExeName " _name)
props.WriteLine("VNT := " vnt)
props.Close()
}
catch as e
{
MsgBox("Writting compile props`nERROR CODE=" . e.Message)
ExitApp
}
}
if InStr(FileExist("dist"), "D")
{
try
{
DirDelete("dist", 1)
}
catch as e
{
MsgBox("removing dist`nERROR CODE=" . e.Message)
ExitApp
}
}
DirCreate("dist")
compile() {
global
if FileExist(binaryFilename)
{
FileDelete(binaryFilename)
}
try
{
RunWait("./ahk-compile-toolset/ahk2exe.exe /in " ahkFilename " /out " binaryFilename " /base `"" A_AhkPath "`" /compress 1")
}
catch as e
{
MsgBox(ahkFilename . "`nERROR CODE=" . e.Message)
ExitApp
}
try
{
RunWait("powershell -command `"Compress-Archive -Path .\" binaryFilename " -DestinationPath " downloadFilename '"', , "Hide")
}
catch as e
{
MsgBox("compress`nERROR CODE=" . e.Message)
ExitApp
}
FileDelete(binaryFilename)
FileMove(downloadFilename, "dist\" downloadFilename, 1)
}
write_prop(0)
compile()
write_prop(1)
compile()
MsgBox("Build Finished")