Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
As you have discovered, Compile_AHK II is not compatible with recent versions of Ahk2Exe. Even with your suggested use of locking in an earlier version of Ahk2Exe, some scripts could be compiled incorrectly depending on the file version number selected in the GUI.
However most facilities offered by Compile_AHK II can be achieved by using the latest Ahk2Exe and Compiler Directives in your scripts, so I would suggest that you see if you can switch over to using these instead.
Hope this helps.
However most facilities offered by Compile_AHK II can be achieved by using the latest Ahk2Exe and Compiler Directives in your scripts, so I would suggest that you see if you can switch over to using these instead.
Hope this helps.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
- TedStriker
- Posts: 8
- Joined: 30 May 2014, 13:46
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Hi, thanks for your answer and for your work improving ahk2exe vastly. As the problems with compile_ahk started, I didn't see that many directives for Ahk2Exe, or I was just blind.
compile_ahk copies "autohotkey.exe" to %temp%, but ahk2exe looks for AutohotkeyU32.exe on my system. So making compile_ahk to copy all .exe files to %temp% was an easy fix, but I guess I'm just beating a dead horse here. It's time to say bye bye to compile_ahk and change my scripts to AHk2exe's directives.
compile_ahk copies "autohotkey.exe" to %temp%, but ahk2exe looks for AutohotkeyU32.exe on my system. So making compile_ahk to copy all .exe files to %temp% was an easy fix, but I guess I'm just beating a dead horse here. It's time to say bye bye to compile_ahk and change my scripts to AHk2exe's directives.
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Could someone please compile a new version of compile_ahkII?
- TedStriker
- Posts: 8
- Joined: 30 May 2014, 13:46
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
It's not needed anymore. Just add - see examples - to your script, right click, "Compile Script".
Code: Select all
;@Ahk2Exe-SetFileVersion 1.2.3.4
;@Ahk2Exe-SetProductVersion %A_AhkVersion%
;@Ahk2Exe-SetMainIcon test.ico
;@Ahk2Exe-ExeName test.exe
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Thank you! Didnt know this...TedStriker wrote: ↑25 Apr 2022, 04:24It's not needed anymore. Just add - see examples - to your script, right click, "Compile Script".
See help file for much more.Code: Select all
;@Ahk2Exe-SetFileVersion 1.2.3.4 ;@Ahk2Exe-SetProductVersion %A_AhkVersion% ;@Ahk2Exe-SetMainIcon test.ico ;@Ahk2Exe-ExeName test.exe
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Is there something like a post-build? So I can run an exe automatically when i compiled an ahk-exe?
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Found it, thank!
PostExec
Specifies a program to be executed after a successful compilation, before (or after) any Compression is applied to the .exe.
;@Ahk2Exe-PostExec Program [parameters] [, When]
PostExec
Specifies a program to be executed after a successful compilation, before (or after) any Compression is applied to the .exe.
;@Ahk2Exe-PostExec Program [parameters] [, When]
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
- deleted-
Last edited by aaffe on 25 May 2022, 07:38, edited 1 time in total.
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Could please someone helP?
I need the exe-Name which will be build from the ahk-Name in the ahk2exe
This doesnt work:
I dont want to Edit the name for the exe in every script. but want to use the same directives in every script...
Thanks.
I need the exe-Name which will be build from the ahk-Name in the ahk2exe
This doesnt work:
Code: Select all
;@Ahk2Exe-Obey U_Name, := RegExReplace(A_ScriptFullPath,"(.*)(ahk)","$1exe")
;@Ahk2Exe-PostExec %A_ScriptDir%\test.ahk %U_Name%"
Thanks.
Last edited by aaffe on 25 May 2022, 08:30, edited 1 time in total.
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
This also doesnt work:
in compile_ahkII.exe I edited the compile_ahk.ahk and inserted
fileInstall,test.ahk,D:\____BUGFIXE_____\test.ahk,0
and at the end
Runwait,D:\____BUGFIXE_____\test.ahk "%Exe_File%",,UseErrorLevel
if (ErrorLevel)
MsgBox,16,Fehler!,Fehler beim aufruf von test.ahk "%Exe_File%"
Msgbox , 262208 , %MSG_TITLE% , Everything done`, bye! , 1
_EXIT(0)
but this isnt possible in ahk2exe.exe....
Code: Select all
;@Ahk2Exe-Obey exename, = StrReplace(A_ScriptFullPath,"ahk","exe")
;@Ahk2Exe-PostExec %A_ScriptDir%\test.ahk "%U_exename%"
fileInstall,test.ahk,D:\____BUGFIXE_____\test.ahk,0
and at the end
Runwait,D:\____BUGFIXE_____\test.ahk "%Exe_File%",,UseErrorLevel
if (ErrorLevel)
MsgBox,16,Fehler!,Fehler beim aufruf von test.ahk "%Exe_File%"
Msgbox , 262208 , %MSG_TITLE% , Everything done`, bye! , 1
_EXIT(0)
but this isnt possible in ahk2exe.exe....
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
@aaffe
It would help if you could describe in more detail what you are attempting to achieve.
Thanks
It would help if you could describe in more detail what you are attempting to achieve.
Thanks
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
@aaffe Some comments on your last post:-
To get the path and name of the compiled script, the code should be:Also note the double-quotes around the parameters to ;@Ahk2Exe-PostExec.
You haven't stated what your test.ahk is doing, but be aware that when the ;@Ahk2Exe-PostExec command is executed, the new "%U_exename%" file has not been created yet. (At this point, the newly compiled .exe is in a work file which can be accessed from the "%A_WorkFileName%" variable.)
Cheers
To get the path and name of the compiled script, the code should be:
Code: Select all
;@Ahk2Exe-Let exename = %A_ScriptFullPath~\.[^\.]+$~.exe%
;@Ahk2Exe-PostExec "%A_ScriptDir%\test.ahk" "%U_exename%"
You haven't stated what your test.ahk is doing, but be aware that when the ;@Ahk2Exe-PostExec command is executed, the new "%U_exename%" file has not been created yet. (At this point, the newly compiled .exe is in a work file which can be accessed from the "%A_WorkFileName%" variable.)
Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
thank you very much Tac109!TAC109 wrote: ↑26 May 2022, 17:46@aaffe Some comments on your last post:-
To get the path and name of the compiled script, the code should be:Also note the double-quotes around the parameters to ;@Ahk2Exe-PostExec.Code: Select all
;@Ahk2Exe-Let exename = %A_ScriptFullPath~\.[^\.]+$~.exe% ;@Ahk2Exe-PostExec "%A_ScriptDir%\test.ahk" "%U_exename%"
You haven't stated what your test.ahk is doing, but be aware that when the ;@Ahk2Exe-PostExec command is executed, the new "%U_exename%" file has not been created yet. (At this point, the newly compiled .exe is in a work file which can be accessed from the "%A_WorkFileName%" variable.)
Cheers
Yes, I need to have the compiled exe to exist when I post its name agains test.ahk. I do some things like virus scan for the exe and sign the exe with a certificate.
With Compile_ahkII I could do this. Is there no possibility to do something when the exe exists with ahk2exe?
Thank you very much!
And how did you do this to get the exe name? It really works, thanks. Looks a bit like regex...
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Rather than use the ;@Ahk2Exe-PostExec method, you are probably best to write your script to RunWait Ahk2Exe with appropriate parameters, then do the scanning and signing after Ahk2Exe has finished. You can test the error code returned from Ahk2Exe to see if the compile worked.
So rather than having Ahk2Exe run your script, your script runs Ahk2Exe instead.
Cheers
So rather than having Ahk2Exe run your script, your script runs Ahk2Exe instead.
Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Ok thanks.TAC109 wrote: ↑30 May 2022, 04:57Rather than use the ;@Ahk2Exe-PostExec method, you are probably best to write your script to RunWait Ahk2Exe with appropriate parameters, then do the scanning and signing after Ahk2Exe has finished. You can test the error code returned from Ahk2Exe to see if the compile worked.
So rather than having Ahk2Exe run your script, your script runs Ahk2Exe instead.
Cheers
Are you thinking of including an after-compiling-section in ahk2exe?
This would be very helpful.
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
No plans at present as this can be easily achieved as stated above.
See this section of the help, just above the RegEx examples.And how did you do this to get the exe name?
Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
Ok, thats a pity. Because then I also have to change the "compile"-key in registry to my own exe and then call ahk2exe.exe with parameters from there. I use to compile on several computers. So I would have to change this at all of them and copy my own exe there and manipulate the registry there.
I think I´m gonna use Compile_AhkII for so long because it still works how described.
But thanks for your work and your answers!
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
@aaffe
From my research it appears that renaming an executable does not invalidate its digital signature. (This renaming is done by Ahk2Exe at the final stage of compilation.)
Therefore you should be able to use the ;@Ahk2Exe-PostExec compiler directive with the 'when' parameter set to 0, 1, or 2 , depending on your compression setting, to digitally sign your executable and perform any other processing required. You would use the "%A_WorkFileName%" parameter to access the compiled .exe.
If you want to handle any compression setting, just use 3 ;@Ahk2Exe-PostExec directives each with its 'when' parameter set to 0, 1, or 2, all calling the same code. Only one will be executed, depending on the compression setting.
Cheers
From my research it appears that renaming an executable does not invalidate its digital signature. (This renaming is done by Ahk2Exe at the final stage of compilation.)
Therefore you should be able to use the ;@Ahk2Exe-PostExec compiler directive with the 'when' parameter set to 0, 1, or 2 , depending on your compression setting, to digitally sign your executable and perform any other processing required. You would use the "%A_WorkFileName%" parameter to access the compiled .exe.
If you want to handle any compression setting, just use 3 ;@Ahk2Exe-PostExec directives each with its 'when' parameter set to 0, 1, or 2, all calling the same code. Only one will be executed, depending on the compression setting.
Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
thank you Tac109.TAC109 wrote: ↑04 Jun 2022, 17:23@aaffe
From my research it appears that renaming an executable does not invalidate its digital signature. (This renaming is done by Ahk2Exe at the final stage of compilation.)
Therefore you should be able to use the ;@Ahk2Exe-PostExec compiler directive with the 'when' parameter set to 0, 1, or 2 , depending on your compression setting, to digitally sign your executable and perform any other processing required. You would use the "%A_WorkFileName%" parameter to access the compiled .exe.
If you want to handle any compression setting, just use 3 ;@Ahk2Exe-PostExec directives each with its 'when' parameter set to 0, 1, or 2, all calling the same code. Only one will be executed, depending on the compression setting.
Cheers
I think I don´t understand the ahk2exe-definitions at all. Could you please give me an Example how to solve this?
Runwait,D:\____BUGFIXE_____\do_signaturing_and_other_things.ahk "%Exe_File%"
Re: Compile_AHK II - for those who compile! [v0.9.2 (04/19/16)]
@aaffe
The first line is executed by Ahk2Exe if there is no compression specified, or the second line is executed by Ahk2Exe if MPRESS compression is specified, or the third line is executed by Ahk2Exe if UPX compression is specified. If you always use the same compressor or always have no compression specified, then you only need the relevant line of code, but it is not a problem to always include all three lines.
Cheers
Code: Select all
;@Ahk2Exe-PostExec "D:\____BUGFIXE_____\do_signaturing_and_other_things.ahk" "%A_WorkFileName%", 0
;@Ahk2Exe-PostExec "D:\____BUGFIXE_____\do_signaturing_and_other_things.ahk" "%A_WorkFileName%", 1
;@Ahk2Exe-PostExec "D:\____BUGFIXE_____\do_signaturing_and_other_things.ahk" "%A_WorkFileName%", 2
Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe