Skip to content

Commit e4849c9

Browse files
authored
Merge pull request #251 from mmikeww/testactions
2 parents d9e708f + c8d5ffb commit e4849c9

File tree

2 files changed

+54
-6
lines changed

2 files changed

+54
-6
lines changed
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build Binary and release
2+
3+
on: # Only run when a release is created
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
BuildAndRelease:
13+
name: Build and Release
14+
runs-on: windows-latest
15+
steps:
16+
- name: Checkout # Get repository
17+
uses: actions/checkout@v2
18+
19+
- name: Ahk2Exe # Build binary
20+
id: ahk2exe
21+
uses: CCCC-L/Action-Ahk2Exe@main
22+
with:
23+
in: QuickConvertorV2.ahk # TODO: v2converter.ahk
24+
25+
- name: Release # Upload binary to most recent release
26+
uses: softprops/action-gh-release@v2
27+
with:
28+
files: QuickConvertorV2.exe

QuickConvertorV2.ahk

+26-6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
{ ;INCLUDES:
4040
#Include ConvertFuncs.ahk
4141
#Include <_GuiCtlExt>
42+
DirCreate(A_ScriptDir "\AutoHotKey Exe")
43+
if !FileExist(A_ScriptDir "\AutoHotKey Exe\AutoHotkeyV1.exe")
44+
FileInstall(".\AutoHotKey Exe\AutoHotkeyV1.exe", A_ScriptDir "\AutoHotKey Exe\AutoHotkeyV1.exe")
45+
if !FileExist(A_ScriptDir "\AutoHotKey Exe\AutoHotkeyV2.exe")
46+
FileInstall(".\AutoHotKey Exe\AutoHotkeyV2.exe", A_ScriptDir "\AutoHotKey Exe\AutoHotkeyV2.exe")
4247
}
4348
{ ;VARIABLES:
4449
global icons, TestMode, TestFailing, FontSize, ViewExpectedCode, GuiIsMaximised, GuiWidth, GuiHeight
@@ -72,7 +77,7 @@
7277
{
7378
case 0: ;IF NO ARGUMENTS THEN LOOK UP SOURCE FILE AND USE DEFAULT OUTPUT FILE
7479
{
75-
FileTempScript := A_ScriptDir "\Tests\TempScript.ah1"
80+
FileTempScript := A_IsCompiled ? A_ScriptDir "\TempScript.ah1" : A_ScriptDir "\Tests\TempScript.ah1"
7681
}
7782
case 1: ;IF ONE ARGUMENT THEN ASSUME THE ARUGMENT IS THE SOURCE FILE (FN) AND USE DEFAULT OUTPUT FILE
7883
{
@@ -281,6 +286,10 @@ CloseV2E(*)
281286
}
282287
CompDiffV2(*)
283288
{
289+
if A_IsCompiled { ; TODO: This should be removed
290+
MsgBox("Not available on compiled version, please download repository or use an online tool", "Diffing not available", 0x30)
291+
Return
292+
}
284293
if (CheckBoxViewSymbols.Value){
285294
MenuShowSymols()
286295
}
@@ -573,7 +582,7 @@ Gui_Size(thisGui, MinMax, Width, Height) ; Expand/Shrink ListView and TreeView
573582
}
574583

575584
Gui_Close(thisGui){
576-
FileTempScript := A_ScriptDir "\Tests\TempScript.ah1"
585+
FileTempScript := A_IsCompiled ? A_ScriptDir "\TempScript.ah1" : A_ScriptDir "\Tests\TempScript.ah1"
577586
if (FileExist(FileTempScript)){
578587
FileDelete(FileTempScript)
579588
}
@@ -715,8 +724,12 @@ GuiTest(strV1Script:="")
715724
; MyGui.OnEvent("Escape", (*) => ExitApp())
716725

717726
FileMenu := Menu()
718-
FileMenu.Add "Run Yunit tests", (*) => Run('"' A_ScriptDir "\AutoHotKey Exe\AutoHotkeyV2.exe" '" "' A_ScriptDir '\Tests\Tests.ahk"')
719-
FileMenu.Add "Open test folder", (*) => Run(TreeRoot)
727+
if !A_IsCompiled {
728+
FileMenu.Add "Run Yunit tests", (*) => Run('"' A_ScriptDir "\AutoHotKey Exe\AutoHotkeyV2.exe" '" "' A_ScriptDir '\Tests\Tests.ahk"')
729+
FileMenu.Add "Open test folder", (*) => Run(TreeRoot)
730+
} else {
731+
FileMenu.Add "Delete all temp files", FileDeleteTemp
732+
}
720733
FileMenu.Add()
721734
FileMenu.Add( "E&xit", (*) => ExitApp())
722735
SettingsMenu := Menu()
@@ -742,7 +755,8 @@ GuiTest(strV1Script:="")
742755
HelpMenu.Add("Open Github", (*)=>Run("https://github.com/mmikeww/AHK-v2-script-converter"))
743756
Menus := MenuBar()
744757
Menus.Add("&File", FileMenu) ; Attach the two submenus that were created above.
745-
Menus.Add("&Settings", SettingsMenu)
758+
if !A_IsCompiled
759+
Menus.Add("&Settings", SettingsMenu)
746760
Menus.Add("&View", ViewMenu)
747761
Menus.Add( "&Reload", (*) => (Gui_Close(MyGui),Reload()))
748762
Menus.Add( "Test", TestMenu)
@@ -841,6 +855,12 @@ MenuShowSymols(*)
841855
CheckBoxViewSymbols.Value := !CheckBoxViewSymbols.Value
842856
ViewSymbols()
843857
}
858+
FileDeleteTemp(*)
859+
{
860+
try DirDelete(A_ScriptDir "\AutoHotKey Exe", true)
861+
try FileDelete("TempScript.ah1")
862+
ExitApp
863+
}
844864
MenuTestMode(*)
845865
{
846866
global
@@ -1110,7 +1130,7 @@ XButton1::
11101130
}
11111131
XButton2::
11121132
{
1113-
FileTempScript := A_ScriptDir "\Tests\TempScript.ah1"
1133+
FileTempScript := A_IsCompiled ? A_ScriptDir "\TempScript.ah1" : A_ScriptDir "\Tests\TempScript.ah1"
11141134
if (FileExist(FileTempScript)){
11151135
FileDelete(FileTempScript)
11161136
}

0 commit comments

Comments
 (0)