Skip to content

Commit

Permalink
Merge pull request #29 from Nigh/opt
Browse files Browse the repository at this point in the history
优化
  • Loading branch information
Nigh authored Oct 30, 2023
2 parents 3055c61 + 4186b36 commit e81af97
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 48 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
ref
*.exe
dist
compile_prop.ahk
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
path = web_gui
url = [email protected]:Nigh/Neutron.ahk.git
branch = v2
[submodule "ahk-compile-toolset"]
path = ahk-compile-toolset
url = https://github.com/Nigh/ahk-compile-toolset.git
1 change: 1 addition & 0 deletions ahk-compile-toolset
Submodule ahk-compile-toolset added at 1989c4
79 changes: 79 additions & 0 deletions distribution.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,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")
48 changes: 15 additions & 33 deletions main.ahk
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
;@Ahk2Exe-AddResource *10 %A_ScriptDir%\html\index.html
;@Ahk2Exe-SetVersion v3.03
;@Ahk2Exe-SetMainIcon iwck.ico
;@Ahk2Exe-SetName i wanna clean keyboard
;@Ahk2Exe-Base AutoHotkey64.exe
;@Ahk2Exe-ExeName iwck
;@Ahk2Exe-SetDescription iwck
#include setting.ahk


#Requires AutoHotkey v2.0
#NoTrayIcon
#MaxThreadsPerHotkey 1
VNT := 0
#include *i compile_prop.ahk
#Include ./web_gui/Neutron.ahk
;@Ahk2Exe-AddResource *10 %A_ScriptDir%\html\index.html

#include *i setting.ahk

block := 0
InHook := InputHook("M L16")
Expand Down Expand Up @@ -74,28 +71,13 @@ RWin:: Return
*CapsLock:: Return
PrintScreen:: Return
Sleep:: Return
; F1::Return
; F2::Return
; F3::Return
; F4::Return
; F5::Return
; F6::Return
; F7::Return
; F8::Return
; F9::Return
; F10::Return
; F11::Return
; F12::Return
; F13::Return
; F14::Return
; F15::Return
; F16::Return
; F17::Return
; F18::Return
; F19::Return
; F20::Return
; F21::Return
; F22::Return
; F23::Return
; F24::Return

Tab:: Return
CapsLock:: Return
LShift:: Return
RShift:: Return
LCtrl:: Return
RCtrl:: Return
LAlt:: Return
RAlt:: Return
#HotIf
15 changes: 0 additions & 15 deletions makefile

This file was deleted.

5 changes: 5 additions & 0 deletions meta.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FileEncoding("UTF-8")
baseName := "iwck"
appName := "i wanna clean keyboard"
version := "3.04"
ahkFilename := "main.ahk"

0 comments on commit e81af97

Please sign in to comment.