Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Upcoming Ahk2Exe changes


  • This topic is locked This topic is locked
78 replies to this topic
fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
I am implementing new functionality in Ahk2Exe, the script compiler; which is now available for testing.

Download (Preview 1e) - 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 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:

Spoiler


just me
  • Members
  • 1496 posts
  • Last active: Nov 03 2015 04:32 PM
  • Joined: 28 May 2011

THX fincs, it's great that this features are supported by the official compiler now.

 

Only one question related to the example:

 

;@Ahk2Exe-SetCopyright Copyright © 2013`, fincs

 

Do we really must escape commas in comment lines?


Prefer ahkscript.org for the time being.


fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

Do we really must escape commas in comment lines?

Compiler directives have to be parsed, and the syntax is command-like; thus the requirement to escape commas (some directives have multiple parameters).

just me
  • Members
  • 1496 posts
  • Last active: Nov 03 2015 04:32 PM
  • Joined: 28 May 2011

... (some directives have multiple parameters).

 

Well, but does ;@Ahk2Exe-SetCopyright have multiple parameters?


Prefer ahkscript.org for the time being.


fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

Well, but does ;@Ahk2Exe-SetCopyright have multiple parameters?

No, but to simplify parsing I made it a requirement to escape commas even if it is the last parameter. Additionally this will allow me to add new parameters to existing directives in the future.

A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

New features

  • Ability to change the version information (such as the name, description, version...).
  • Ability to add resources to the compiled script.

Many thanks ! grin.png


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Awesome ! Gave it a try..

 

One question --

  • I prefer UPX over Mpress. What should I do to compress my exe at the time of compiling. Name it to Mpress.exe confused.png

Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

I prefer UPX over Mpress. What should I do to compress my exe at the time of compiling.

You can fool Ahk2Exe into using UPX creating a decoy mpress.exe that is just a compiled decoy script, and that would forward its parameters to UPX. The command line that Ahk2Exe passes to it is mpress.exe -q -x "%ExeFile%", so something like this would work (edit the UPX command line at your will):
RunWait, "%A_ScriptDir%\upx.exe" "%3%"
In the future I may add a directive to run a command after compilation (such as UPX).

Zaelia
  • Members
  • 754 posts
  • Last active: Jan 17 2015 02:38 AM
  • Joined: 31 Oct 2008

Edit: Sorry I posted at same time, I don't delete...

 

@AVI: Perhaps you can create a custom AHK2EXE, go to https://github.com/fincs/Ahk2Exe and open compiler.ahk, find lines about "mpress.exe" and change to your favor. I haven't try, but I guess it's possible to use only source without compile the project, seems they are debugs for a script form, I guess it is because ease of use and compile right click menu, maybe you can replace registry key by something like "autohotkeyfullpath /in ahk2exe.ahk %l"

If you rename your UPX.exe to mpress.exe the line code "RunWait, "%A_ScriptDir%\mpress.exe" -q -x "%ExeFile%",, Hide" will be missinterpreted because of parameters... Maybe fincs will add a "compressor command line" directive

 

@fincs: I wonder why AHK2EXE is distribued as an executable and not as an preprocess script or a one .ahk file.

Why edit fields are disabled to type and why we can't drag and drop to other edit fields.

Maybe add a URL link in your help menu bar if it not planned to change ahk help file(https://ahknet.autoh...eDirectives.htm)

However GOOD JOB !


"You annoy me, therefore I exist."

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

I wonder why AHK2EXE is distribued as an executable and not as an preprocess script or a one .ahk file.

Ahk2Exe consists of many source code files. It is also easier for people to just replace their existing Ahk2Exe.exe with the one in the OP.
If you mean why is Ahk2Exe a compiled script in the official distribution, it's for backwards compatibility.
 

why we can't drag and drop to other edit fields

You can drop both .ahk and .ico files to the Ahk2Exe GUI.
 

Maybe add a URL link in your help menu bar if it not planned to change ahk help file

The AHK help file will be updated obviously.

A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

You can fool Ahk2Exe into using UPX creating a decoy mpress.exe that is just a compiled decoy script, and that would forward its parameters to UPX. The command line that Ahk2Exe passes to it is mpress.exe -q -x "%ExeFile%", so something like this would work (edit the UPX command line at your will):

RunWait, "%A_ScriptDir%\upx.exe" "%3%"
In the future I may add a directive to run a command after compilation (such as UPX). 

Excellent,

that should work definitely.  Thanks for the great piece , fincs !

 

One more question, Should I suppose that I can put the Ahk2exe directives anywhere, just anywhere !

EDit:

Let me be clear, by just anywhere I mean I will put them only with the start of a line, not inline


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007

One more question, Should I suppose that I can put the Ahk2exe directives anywhere, just anywhere !
EDit:
Let me be clear, by just anywhere I mean I will put them only with the start of a line, not inline

Yes.

Pulover
  • Members
  • 1596 posts
  • Last active: Apr 06 2016 04:00 AM
  • Joined: 20 Apr 2012

That's very nice! Thanks!


Rodolfo U. Batista
Pulover's Macro Creator - Automation Tool (Recorder & Script Writer) | Class_LV_Rows - Copy, Cut, Paste and Drag ListViews | Class_Toolbar - Create and modify | Class_Rebar - Adjustable GUI controls

Join the New AutoHotkey Forum!


fischgeek
  • Moderators
  • 1074 posts
  • Last active: Jul 07 2015 06:27 PM
  • Joined: 20 Apr 2009

Nice work! One question though... Might be a stupid question, but it's one I've always wondered and never had answered. How do I use a resource in my exe? We can very easily add a resource with your new version, but I have no idea how to call it in the script. For example, an image or an html based help file.



fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
I have just uploaded a demo package that shows exactly how to use Bitmap and HTML resources. During the making of the script I discovered a bug in Ahk2Exe; I've fixed it and uploaded Preview 1a.