Page 1 of 7

Upcoming Ahk2Exe changes

Posted: 04 Nov 2013, 16:38
by fincs
I am implementing new functionality in Ahk2Exe, the script compiler; which is now available for testing.

Download (Preview 2a) - this zip file contains Ahk2Exe.exe which you can drop right into your Compiler folder.
Source

New features
  • Ability to change the version information (such as the name, description, version...).
  • Ability to add resources to the compiled script.
  • Ability to tweak several misc aspects of compilation.
  • Ability to remove code sections from the compiled script and viceversa.
Documentation
Have a look at the WIP compiler directives documentation.

Examples
NEW: Bitmap and HTML resource demo (requires at least Preview 1a)

The script below is a very crude example that I used for testing but which should nevertheless show the new capabilities of Ahk2Exe:

Code: Select all

MsgBox Hello

;@Ahk2Exe-SetName Awesome
;@Ahk2Exe-SetDescription Some awesome script
;@Ahk2Exe-SetVersion 1.7.52-beta
;@Ahk2Exe-SetCopyright Copyright (c) 2013`, fincs
;@Ahk2Exe-SetOrigFilename Awesome.ahk

;@Ahk2Exe-AddResource someBmp.bmp
;@Ahk2Exe-AddResource test.html
;@Ahk2Exe-UseResourceLang 0x340A
;@Ahk2Exe-AddResource test_sp.html, test.html

;@Ahk2Exe-IgnoreBegin
MsgBox This will appear in the uncompiled script!
;@Ahk2Exe-IgnoreEnd

/*@Ahk2Exe-Keep
MsgBox This will appear in the compiled script!
*/

MsgBox Bye

Re: Upcoming Ahk2Exe changes

Posted: 05 Nov 2013, 22:18
by oldbrother
Nice!

Re: Upcoming Ahk2Exe changes

Posted: 29 Nov 2013, 03:00
by joedf
Can't wait for it to be the official release :P

Re: Upcoming Ahk2Exe changes

Posted: 06 Dec 2013, 13:30
by fincs
Uploaded Preview 2, see git log:

Code: Select all

Do not use LastIcon and LastBinFile if those files do not exist
----
Add new directives, see details:

;@Ahk2Exe-SetCompanyName txt
    Obvious
;@Ahk2Exe-SetMainIcon [icoFile]
    Overrides the exe icon used for compilation. If the icon parameter
    is not specified, the icon is left as the default AHK icon.
;@Ahk2Exe-PostExec command
    Executes a command after compilation.
;@Ahk2Exe-UseSeparateTrayIcon
    Makes the AHK runtime continue to use the separate tray icon
    resource as in compiled scripts with no custom icon.
;@Ahk2Exe-SetConsoleSubsys
    Changes the executable subsystem to Console mode.
Todo list:
  • Add support in directives for specifying things such as %A_ScriptFullPath%.
  • Add support for changing or adding arbitrary fields in version info.
  • Add support for replacing and deleting resources.
  • Icon resource support.
  • If there is enough demand: cursor resource support.

Re: Upcoming Ahk2Exe changes

Posted: 06 Dec 2013, 13:51
by joedf
Hoorrray! You've added the Console subsystem! :D
Yay! Mister LibCon.ahk will be happy :D

Re: Upcoming Ahk2Exe changes

Posted: 29 Mar 2014, 13:02
by step
It took me a while to find the new home of this thread, I was still hanging out the old forum; I didn't realize this is where the action is. Well, now I know. Back on topic now.
I was intrigued about the AddResource directive and played a little with the Bitmap and HTML resource demo (download from the first post). So I figured how to add PNG resources and use them in an HTML resource.

Code: Select all

;@Ahk2Exe-AddResource test.png
;@Ahk2Exe-AddResource test.html

Code: Select all

<!DOCTYPE html>
<html><head></head><body>
    <img src="res://test.exe/10/test.png">
</body>
</html>
Note that the script exe name test.exe must be embedded into the resource file. This isn't ideal (limits renaming and portability), but I couldn't figure out another way to make the res:// protocol find the png resource. I think the filename suffices as long as it's in the PATH or in the working dir. See references for more info.
10 is the RCDATA resource type, works for png. Use 2 for bmp.

References:
res protocol: http://support.microsoft.com/kb/220830 and http://msdn.microsoft.com/en-us/library ... 85%29.aspx
resource types: http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Edit:
Possibly a work-around for needing to embed the script exe name could be for the script to create a hard or soft link to %A_ScriptFullPath% and specify the link name in the res:// protocol line. It should work (untested).

Re: Upcoming Ahk2Exe changes

Posted: 21 Apr 2014, 02:48
by joedf
I wonder... When is this gonna replace the main "branch".
Does it still have any know stability issues? Just curious... :P

Re: Upcoming Ahk2Exe changes

Posted: 27 Oct 2014, 02:42
by jNizM
Is there anything new fincs? A possible release date?

Re: Upcoming Ahk2Exe changes

Posted: 27 Oct 2014, 03:05
by joedf
Yes, for now I'm not using it. I am waiting for it to be the "stable" release. I really want to use those directives :P
It would be good to actually have these directives IN the Ahk docs too, once it is "Stable".

Re: Upcoming Ahk2Exe changes

Posted: 27 Oct 2014, 04:06
by vasili111
Yes, it will be nice to see these changes in stable version of AutoHotkey.

Re: Upcoming Ahk2Exe changes

Posted: 30 Oct 2014, 06:17
by xZomBie
@finc when will this be released in the stable AutoHotkey installer?

Re: Upcoming Ahk2Exe changes

Posted: 30 Oct 2014, 10:48
by fincs
I currently consider this low priority due to my lack of time to finish it and apparently the lack of demand. Nonetheless I hope to finish it in the future.

Re: Upcoming Ahk2Exe changes

Posted: 30 Oct 2014, 23:50
by xZomBie
I hope that the future is near. :D
Just realized that I spelled your name wrong... Sorry about that fincs...

Re: Upcoming Ahk2Exe changes

Posted: 13 Dec 2014, 13:11
by Peter2
fincs wrote:.... and apparently the lack of demand. ...
The demand is here - but this release is not so easy to find...

Re: Upcoming Ahk2Exe changes

Posted: 13 Dec 2014, 19:56
by joedf
+1

Re: Upcoming Ahk2Exe changes

Posted: 24 Dec 2014, 06:25
by joedf
For /NoDecompile discussion, please go to the following topic : http://ahkscript.org/boards/viewtopic.php?f=13&t=5699

Re: Upcoming Ahk2Exe changes

Posted: 04 Jan 2015, 12:10
by tmplinshi
It seems the tray icon not changed, only main icon.

Re: Upcoming Ahk2Exe changes

Posted: 04 Jan 2015, 22:07
by Bruttosozialprodukt
I'm soo stoked for this!
Especially for the version info. But adding resources sounds awesome too.

And I agree this is too hard to find. It didn't show up for me when I googled for "autohtkey alternative compiler".

Re: Upcoming Ahk2Exe changes

Posted: 04 Jan 2015, 22:29
by joedf
;@Ahk2Exe-SetConsoleSubsys
is really cool, since ahk will "official" support scripting console "apps"..
I do think that when this is a stable release, that all these ahk2exe directives should be thoroughly documented in the ahk documentation. ;)

Re: Upcoming Ahk2Exe changes

Posted: 05 Jan 2015, 06:30
by lexikos
Why not ;@Ahk2Exe-SetTrayIcon to go with ;@Ahk2Exe-SetMainIcon instead of ;@Ahk2Exe-UseSeparateTrayIcon?

One useful resource type not mentioned in the documentation is 24 - the executable manifest. The most useful edit is to change the requestedExecutionLevel element's level attribute to requireAdministrator. The manifest must have ID 1:

Code: Select all

;@Ahk2Exe-AddResource *24 AutoHotkey.exe.manifest, 1