generated from Nigh/ahk-autoupdate-template
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
distribution.ahk
91 lines (81 loc) · 1.74 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
80
81
82
83
84
85
86
87
88
89
90
91
#SingleInstance Force
SetWorkingDir(A_ScriptDir)
#include meta.ahk
try
{
props := FileOpen("compile_prop.ahk", "w")
props.WriteLine(";@Ahk2Exe-SetName " appName)
props.WriteLine(";@Ahk2Exe-SetVersion " version)
props.WriteLine(";@Ahk2Exe-SetMainIcon icon.ico")
props.WriteLine(";@Ahk2Exe-SetCompanyName HelloWorks")
props.WriteLine(";@Ahk2Exe-SetDescription ahko")
props.WriteLine(";@Ahk2Exe-ExeName " appName)
props.Close()
}
catch as e
{
MsgBox("Writting compile props`nERROR CODE=" . e.Message)
ExitApp
}
if FileExist(binaryFilename)
{
FileDelete(binaryFilename)
}
if FileExist(versionFilename)
{
FileDelete(versionFilename)
}
if InStr(FileExist("dist"), "D")
{
try
{
DirDelete("dist", 1)
}
catch as e
{
MsgBox("removing dist`nERROR CODE=" . e.Message)
ExitApp
}
}
DirCreate("dist")
try
{
RunWait("./ahk-compile-toolset/ahk2exe.exe /in updater.ahk /out updater.exe /base `"" A_AhkPath "`" /compress 1")
}
catch as e
{
MsgBox("updater.ahk`nERROR CODE=" . e.Message)
ExitApp
}
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("./ahk-compile-toolset/AutoHotkey64.exe .\" . ahkFilename . " --out=version")
}
catch as e
{
MsgBox("get version`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)
FileDelete("updater.exe")
FileMove(downloadFilename, "dist\" downloadFilename, 1)
FileMove(versionFilename, "dist\" versionFilename, 1)
MsgBox("Build Finished")