forked from Pulover/PuloversMacroCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Compile.ahk
195 lines (173 loc) · 6.56 KB
/
Compile.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#NoEnv
SetBatchLines -1
SetWorkingDir %A_ScriptDir%
SplitPath, A_AhkPath,, AhkDir
FileCreateDir, Compiled
FileCreateDir, Compiled\Lang
FileCreateDir, Documentation\MacroCreator_Help-doc\Commands
IfWinExist, ahk_exe MacroCreator.exe
{
WinClose
WinWaitClose
}
FileDelete, Documentation\MacroCreator_Help-doc\*.html
FileDelete, Documentation\MacroCreator_Help-doc\Commands\*.html
FileCopy, Documentation\License.html, Documentation\MacroCreator_Help-doc, 1
RunWait, Documentation\GenDocs-mod.ahk,, UseErrorLevel
If ErrorLevel
ExitApp
RunWait, BuildFiles.ahk,, UseErrorLevel
If ErrorLevel
ExitApp
RunWait, Documentation\MacroCreator_Help-doc\CompileCHM.ahk,, UseErrorLevel
If ErrorLevel
ExitApp
FileCopy, Documentation\MacroCreator_Help-doc\MacroCreator_Help.chm, Compiled\MacroCreator_Help.chm, 1
FileDelete, Compiled\Resources.dll
FileDelete, Compiled\SciLexer-x64.dll
FileDelete, Compiled\SciLexer-x86.dll
FileDelete, Compiled\Demo.pmc
FileDelete, Compiled\Lang\*.*
FileCopy, Resources.dll, Compiled\Resources.dll, 1
FileCopy, SciLexer-x64.dll, Compiled\SciLexer-x64.dll, 1
FileCopy, SciLexer-x86.dll, Compiled\SciLexer-x86.dll, 1
FileCopy, Documentation\MacroCreator_Help-doc\Examples\Demo.pmc, Compiled\Demo.pmc, 1
FileCopy, Lang\*.lang, Compiled\Lang\, 1
RunWait, %AhkDir%\Compiler\Ahk2Exe.exe /in MacroCreator.ahk /out Compiled\MacroCreator.exe /icon Resources\PMC4_Mult.ico /bin "%AhkDir%\Compiler\Unicode 32-bit.bin",, UseErrorLevel
If (ErrorLevel = "ERROR")
{
MsgBox, 0x40000, Error, % "Error code: " A_LastError " at line " A_LineNumber - 3
ExitApp
}
RunWait, %AhkDir%\Compiler\Ahk2Exe.exe /in MacroCreator.ahk /out Compiled\MacroCreator-x64.exe /icon Resources\PMC4_Mult.ico /bin "%AhkDir%\Compiler\Unicode 64-bit.bin",, UseErrorLevel
If (ErrorLevel = "ERROR")
{
MsgBox, 0x40000, Error, % "Error code: " A_LastError " at line " A_LineNumber - 3
ExitApp
}
RunWait, %ProgramFiles%\Inno Setup 5\iscc.exe %A_ScriptDir%\Installer.iss,, UseErrorLevel
If (ErrorLevel = "ERROR")
{
RunWait, %ProgramFiles% (x86)\Inno Setup 5\iscc.exe %A_ScriptDir%\Installer.iss,, UseErrorLevel
If (ErrorLevel = "ERROR")
{
MsgBox, 0x40000, Error, % "Error code: " A_LastError " at line " A_LineNumber - 3
ExitApp
}
}
FileRemoveDir, Compiled\MacroCreatorPortable, 1
FileCreateDir, Compiled\MacroCreatorPortable
FileCreateDir, Compiled\MacroCreatorPortable\x86
FileCreateDir, Compiled\MacroCreatorPortable\x64
FileCreateDir, Compiled\MacroCreatorPortable\x86\MacroCreator
FileCreateDir, Compiled\MacroCreatorPortable\x64\MacroCreator
FileCreateDir, Compiled\MacroCreatorPortable\x86\MacroCreator\Lang
FileCreateDir, Compiled\MacroCreatorPortable\x64\MacroCreator\Lang
IniWrite, 0, Compiled\MacroCreator.ini, Options, AutoUpdate
FileCopy, License.txt, Compiled\MacroCreatorPortable\, 1
FileCopy, Compiled\MacroCreator.exe, Compiled\MacroCreatorPortable\x86\MacroCreator\, 1
FileCopy, Compiled\MacroCreator.ini, Compiled\MacroCreatorPortable\x86\MacroCreator\, 1
FileCopy, Compiled\MacroCreator_Help.chm, Compiled\MacroCreatorPortable\x86\MacroCreator\, 1
FileCopy, Compiled\MacroCreator_Help_CN.chm, Compiled\MacroCreatorPortable\x86\MacroCreator\, 1
FileCopy, Compiled\Resources.dll, Compiled\MacroCreatorPortable\x86\MacroCreator\, 1
FileCopy, Compiled\SciLexer-x86.dll, Compiled\MacroCreatorPortable\x86\MacroCreator\SciLexer.dll, 1
FileCopy, Compiled\Demo.pmc, Compiled\MacroCreatorPortable\x86\MacroCreator\Demo.pmc, 1
FileCopy, Compiled\Lang\*.lang, Compiled\MacroCreatorPortable\x86\MacroCreator\Lang\, 1
FileCopy, Compiled\MacroCreator-x64.exe, Compiled\MacroCreatorPortable\x64\MacroCreator\MacroCreator.exe, 1
FileCopy, Compiled\MacroCreator.ini, Compiled\MacroCreatorPortable\x64\MacroCreator\, 1
FileCopy, Compiled\MacroCreator_Help.chm, Compiled\MacroCreatorPortable\x64\MacroCreator\, 1
FileCopy, Compiled\MacroCreator_Help_CN.chm, Compiled\MacroCreatorPortable\x64\MacroCreator\, 1
FileCopy, Compiled\Resources.dll, Compiled\MacroCreatorPortable\x64\MacroCreator\, 1
FileCopy, Compiled\SciLexer-x64.dll, Compiled\MacroCreatorPortable\x64\MacroCreator\SciLexer.dll, 1
FileCopy, Compiled\Demo.pmc, Compiled\MacroCreatorPortable\x64\MacroCreator\Demo.pmc, 1
FileCopy, Compiled\Lang\*.lang, Compiled\MacroCreatorPortable\x64\MacroCreator\Lang\, 1
IniRead, Ver, MacroCreator.ini, Application, Version
FileAppend,
(
Pulover's Macro Creator v%Ver% Portable Edition
===============================================
Thank you for downloading Pulover's Macro Creator.
Supported platforms: Windows 7, 8, 8.1, 10
NOT tested on: Windows XP, Vista
This file contains both x86 and x64 builds.
), Compiled\MacroCreatorPortable\ReadMe.txt
FileDelete, Compiled\PuloversMacroCreator-Portable.zip
FileDelete, Compiled\Lang.zip
Zip(A_ScriptDir "\Compiled\MacroCreatorPortable", A_ScriptDir "\Compiled\PuloversMacroCreator-Portable.zip")
Zip(A_ScriptDir "\Compiled\Lang\*.lang", A_ScriptDir "\Compiled\Lang.zip")
TrayTip,, Finished compiling files.
Sleep, 2000
return
Zip(FilesToZip, OutFile, SeparateFiles := false)
{
Static vOptions := 4|16
FilesToZip := StrReplace(FilesToZip, "`n", ";")
FilesToZip := StrReplace(FilesToZip, ",", ";")
FilesToZip := Trim(FilesToZip, ";")
objShell := ComObjCreate("Shell.Application")
If (SeparateFiles)
SplitPath, OutFile,, OutDir
Else
{
If (!FileExist(OutFile))
CreateZipFile(OutFile)
objTarget := objShell.Namespace(OutFile)
}
zipped := objTarget.items().Count
Loop, Parse, FilesToZip, `;, %A_Space%%A_Tab%
{
LoopField := RTrim(A_LoopField, "\")
Loop, Files, %LoopField%, FD
{
zipped++
If (SeparateFiles)
{
OutFile := OutDir "\" RegExReplace(A_LoopFileName, "\.(?!.*\.).*") ".zip"
If (!FileExist(OutFile))
CreateZipFile(OutFile)
objTarget := objShell.Namespace(OutFile)
zipped := 1
}
For item in objTarget.Items
{
If (item.Name = A_LoopFileDir)
{
item.InvokeVerb("Delete")
zipped--
break
}
If (item.Name = A_LoopFileName)
{
FileRemoveDir, % A_Temp "\" item.Name, 1
FileDelete, % A_Temp "\" item.Name
objShell.Namespace(A_Temp).MoveHere(item)
FileRemoveDir, % A_Temp "\" item.Name, 1
FileDelete, % A_Temp "\" item.Name
zipped--
break
}
}
If (A_LoopFileFullPath = OutFile)
{
zipped--
continue
}
objTarget.CopyHere(A_LoopFileFullPath, vOptions)
While (objTarget.items().Count != zipped)
Sleep, 10
}
}
ObjRelease(objShell)
}
CreateZipFile(sZip)
{
CurrentEncoding := A_FileEncoding
FileEncoding, CP1252
Header1 := "PK" . Chr(5) . Chr(6)
VarSetCapacity(Header2, 18, 0)
file := FileOpen(sZip,"w")
file.Write(Header1)
file.RawWrite(Header2,18)
file.close()
FileEncoding, %CurrentEncoding%
}