39
39
{ ; INCLUDES:
40
40
#Include ConvertFuncs.ahk
41
41
#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" )
42
47
}
43
48
{ ; VARIABLES:
44
49
global icons, TestMode, TestFailing, FontSize, ViewExpectedCode, GuiIsMaximised, GuiWidth, GuiHeight
72
77
{
73
78
case 0 : ; IF NO ARGUMENTS THEN LOOK UP SOURCE FILE AND USE DEFAULT OUTPUT FILE
74
79
{
75
- FileTempScript := A_ScriptDir " \Tests\TempScript.ah1"
80
+ FileTempScript := A_IsCompiled ? A_ScriptDir " \TempScript.ah1 " : A_ScriptDir " \Tests\TempScript.ah1"
76
81
}
77
82
case 1 : ; IF ONE ARGUMENT THEN ASSUME THE ARUGMENT IS THE SOURCE FILE (FN) AND USE DEFAULT OUTPUT FILE
78
83
{
@@ -281,6 +286,10 @@ CloseV2E(*)
281
286
}
282
287
CompDiffV2(* )
283
288
{
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
+ }
284
293
if (CheckBoxViewSymbols.Value){
285
294
MenuShowSymols()
286
295
}
@@ -573,7 +582,7 @@ Gui_Size(thisGui, MinMax, Width, Height) ; Expand/Shrink ListView and TreeView
573
582
}
574
583
575
584
Gui_Close (thisGui ){
576
- FileTempScript := A_ScriptDir " \Tests\TempScript.ah1"
585
+ FileTempScript := A_IsCompiled ? A_ScriptDir " \TempScript.ah1 " : A_ScriptDir " \Tests\TempScript.ah1"
577
586
if (FileExist (FileTempScript)){
578
587
FileDelete (FileTempScript)
579
588
}
@@ -715,8 +724,12 @@ GuiTest(strV1Script:="")
715
724
; MyGui.OnEvent("Escape", (*) => ExitApp())
716
725
717
726
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
+ }
720
733
FileMenu.Add()
721
734
FileMenu.Add( " E&xit" , (* ) => ExitApp ())
722
735
SettingsMenu := Menu ()
@@ -742,7 +755,8 @@ GuiTest(strV1Script:="")
742
755
HelpMenu.Add(" Open Github" , (* )=>Run (" https://github.com/mmikeww/AHK-v2-script-converter" ))
743
756
Menus := MenuBar()
744
757
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)
746
760
Menus.Add(" &View" , ViewMenu)
747
761
Menus.Add( " &Reload" , (* ) => (Gui_Close(MyGui),Reload ()))
748
762
Menus.Add( " Test" , TestMenu)
@@ -841,6 +855,12 @@ MenuShowSymols(*)
841
855
CheckBoxViewSymbols.Value := ! CheckBoxViewSymbols.Value
842
856
ViewSymbols()
843
857
}
858
+ FileDeleteTemp(* )
859
+ {
860
+ try DirDelete(A_ScriptDir " \AutoHotKey Exe" , true )
861
+ try FileDelete (" TempScript.ah1" )
862
+ ExitApp
863
+ }
844
864
MenuTestMode(* )
845
865
{
846
866
global
@@ -1110,7 +1130,7 @@ XButton1::
1110
1130
}
1111
1131
XButton2 ::
1112
1132
{
1113
- FileTempScript := A_ScriptDir " \Tests\TempScript.ah1"
1133
+ FileTempScript := A_IsCompiled ? A_ScriptDir " \TempScript.ah1 " : A_ScriptDir " \Tests\TempScript.ah1"
1114
1134
if (FileExist (FileTempScript)){
1115
1135
FileDelete (FileTempScript)
1116
1136
}
0 commit comments