Upcoming Ahk2Exe changes

Community news and information about new or upcoming versions of AutoHotkey
jiyongred
Posts: 2
Joined: 28 Dec 2015, 02:52
GitHub: benallred

Re: Upcoming Ahk2Exe changes

28 Dec 2015, 03:28

@fincs

I really wanted .ico resource support in this preview, so I added it and submitted a pull request. https://github.com/fincs/Ahk2Exe/pull/42

There are a lot of firsts for me here (this post, a pull request on open source, etc) so please feel free to point out ways it could be done better or if this approach is completely wrong. I'm willing to learn.

Jiyongred
lexikos
Posts: 5455
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Upcoming Ahk2Exe changes

28 Dec 2015, 23:59

Hi Jiyongred, welcome to the forums and thanks for the contribution. Looks like fincs has merged it already. :)
User avatar
Nextron
Posts: 1064
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Upcoming Ahk2Exe changes

26 Jan 2016, 09:22

So now AHK 1.1.23 supports handles for image commands, how would that work with compiled scripts with included resources?
The more I know:
The more I know,
I know nothing.
lexikos
Posts: 5455
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Upcoming Ahk2Exe changes

26 Jan 2016, 20:08

The same way as before, except that once you have loaded the resource and got a bitmap/icon handle, using it is easier.
User avatar
Nextron
Posts: 1064
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Upcoming Ahk2Exe changes

28 Jan 2016, 05:37

I was hoping for an actual example (with might be useful for others too, because in this thread I can't find one). What I found in other threads was setting a handle to an actual file and using sendmessage to a controls hWnd to update an image. In this case, it wouldn't concern a file, I wouldn't know the hWnd for a SplashImage and settings it afterwards would mean wrong window dimensions.
The more I know:
The more I know,
I know nothing.
User avatar
Taurus
Posts: 45
Joined: 20 Jan 2015, 10:31

Re: Upcoming Ahk2Exe changes

28 Jan 2016, 11:57

Hi,

I have a problem with this:

Code: [Select all] [Download] GeSHi © Codebox Plus

;@Ahk2Exe-AddResource lib\lib_add.exe	

BinRun("lib_add.exe",,, 0, A_ScriptFullPath) ; from ahk h

It's not working. Is there another way to run an exe from resource? Maybe something like RunWait, res:\lib_add.exe?

Would be very great, if we can use resources like files on a disk. That would make things much easier. :)
Dev for a better world :) > PHP for Web > AHK H for Local > with KISS (Keep it Short and Simple) on Win 10 Pro (Version 1703) x64
User avatar
BGM
Posts: 386
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: Upcoming Ahk2Exe changes

01 Jun 2016, 22:42

Yay! I was just talking to GeekDude about this! Now I won't have to use Resource Hacker anymore!
Daniel Beardsmore
Posts: 11
Joined: 23 Jul 2016, 15:57

Re: Upcoming Ahk2Exe changes

30 Jul 2016, 20:18

I'm just throwing this out there to gauge opinion, as I'm not wholly certain of its merits yet.

I'm contemplating whether it would make sense to indicate the target detail.

;@Ahk2Exe-Base base-name
;@Ahk2Exe-OutputDir target-dir

Where the output directory is relative to the script.

This way, you could have:

My Project 32-bit.ahk :=

Code: [Select all] [Download] GeSHi © Codebox Plus

;@Ahk2Exe-Base Unicode 32-bit.bin
;@Ahk2Exe-OutputDir My Project 32-bit
#Include "Main.ahk"


My Project 64-bit.ahk :=

Code: [Select all] [Download] GeSHi © Codebox Plus

;@Ahk2Exe-Base Unicode 64-bit.bin
;@Ahk2Exe-OutputDir My Project 64-bit
#Include "Main.ahk"


The idea is that you could simply right-click each of the "My Project*.ahk" files and click Compile, to directly create 32-bit and 64-bit builds.

I don't know yet whether I'm going to use separate builds. My program is a wrapper around 7-Zip, and the only 32-bit/64-bit concern that I have is the need to read from HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip in the native architecture view (assuming that the correct version of 7-Zip is installed), and I should be able to do this with RegView from a single 32-bit build. Even so, it would be nice to be able to assert to the compiler that, even though I normally run in 64-bit Unicode, that the single build is to be 32-bit Unicode for use on 32-bit PCs.

The alternative is to write a separate script that invokes the compiler, but what good is right-click → Compile if you're trapped with whatever settings you chose during installation?
lexikos
Posts: 5455
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Upcoming Ahk2Exe changes

30 Jul 2016, 21:37

I can see where that might be useful.

I think that "Bin" would be more intuitive than "Base". Aside from the filename extension, we already use "bin" for the command-line switch.

What if the compiled file should be named differently than the main source file?

Perhaps it would make sense to allow specifying defaults for the command line switches within the script.

/out could allow a directory (and just append the name automatically), but if the directory doesn't exist, it would be necessary to create the directory manually or pass "target-dir\\" (otherwise the slash has the effect of escaping the quote mark).

It would also be useful for the /bin switch to take a bin file from the Compiler directory if it wasn't found in the working directory.
User avatar
joedf
Posts: 6008
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: Upcoming Ahk2Exe changes

31 Jul 2016, 05:30

I think ill implement this. :geek:
Btw, shouldn't it be "target-dir\^" on windows? :0
lexikos
Posts: 5455
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Upcoming Ahk2Exe changes

31 Jul 2016, 06:28

No, that is neither the correct escape character nor the correct place to put it. Escaping the quote mark is exactly what we don't want. It's easily tested by running a script with ListVars from another script.
Daniel Beardsmore
Posts: 11
Joined: 23 Jul 2016, 15:57

Re: Upcoming Ahk2Exe changes

31 Jul 2016, 12:01

Another thing I noticed — there are no constants in AutoHotkey. This isn't unique to AHK — they're also missing from JavaScript and CSS. Constants have that nice semantic that the reader knows that the value specified will not change, cannot change, and is not intended to change. It also prevents accidental overwrite.

It's always a nuisance when you have to define the same details in numerous places, such as the compiler directives, script, readme, installer script and website.

Personally I would put most of the @Ahk2Exe-Set… details in constants.

Like:

define k_APPNAME "7-ade"

;@Ahk2Exe-SetName @{k_APPNAME}
;@Ahk2Exe-SetOrigFilename @{k_APPNAME}.exe



Gui, Show, Center, % k_APPNAME
TAC109
Posts: 192
Joined: 02 Oct 2013, 19:41

Re: Upcoming Ahk2Exe changes

31 Jul 2016, 17:19

Any chance that preview2a will be incorporated into the main AHK download anytime soon?

This enhancement has been around for about 2.5 years now, and fincs doesn't seem to be around anymore to complete the implementation.
My programs:-
ReClip - a Text Reformatting and Clip Management utility
XRef - Produces Cross Reference lists for scripts

User avatar
joedf
Posts: 6008
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: Upcoming Ahk2Exe changes

01 Aug 2016, 14:03

lexikos wrote:No, that is neither the correct escape character nor the correct place to put it. Escaping the quote mark is exactly what we don't want. It's easily tested by running a script with ListVars from another script.
Oh wow haha sorry! please excuse me, I was half asleep when I posted that. :facepalm: What i meant was ^"target-dir\^". :crazy:
Now that I am myself :monkeysee: why is it not simply "target-dir\" instead of "target-dir\\"?
Daniel Beardsmore wrote:[...]define k_APPNAME "7-ade"[...]
That looks like a c-style definition which is usually more on the compiler side than it is on the "script" part.
I imagine ahk2exe could have something like ;@Ahk2Exe-Define MY_CONSTANT "some text and numbers. 1234567890".
TAC109 wrote:Any chance that preview2a will be incorporated into the main AHK download anytime soon?
This enhancement has been around for about 2.5 years now, and fincs doesn't seem to be around anymore to complete the implementation.
Yes, a long hiatus I must say. However, he has given us his notice. Sadly, this can happen quite often in smaller size open source projects. :?
Daniel Beardsmore
Posts: 11
Joined: 23 Jul 2016, 15:57

Re: Upcoming Ahk2Exe changes

01 Aug 2016, 14:55

joedf wrote:
Daniel Beardsmore wrote:[...]define k_APPNAME "7-ade"[...]
That looks like a c-style definition which is usually more on the compiler side than it is on the "script" part.
I imagine ahk2exe could have something like ;@Ahk2Exe-Define MY_CONSTANT "some text and numbers. 1234567890".


If you define the constants inside ahk2exe, then the script won't run. AutoHotkey must be responsible for them, otherwise the script will contain symbols that won't exist until compilation. The idea was that the constants would be shared between the compiler directives and the script, so that you don't get your .exe VERSIONINFO and program details out of sync. (Which will already happen between the program, readme, installer and website … :S )

(In the case of the likes of Inno Setup, one could actually rebuild the .iss file from this data. I've gone over to a compile.ahk script that runs ahk2exe, and I guess I could #include a common file with the version data in, and include a rebuild of the .iss file in there somewhere. But only if the version is a constant. Inno Setup is in my bad books though for ISPP being such a pig to use.)

("However, he has given us his notice." — does that not indicate an intention to resign in Canadian English? It does in Britain. That's the opposite of what his thread seems to indicate :-)
User avatar
joedf
Posts: 6008
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: Upcoming Ahk2Exe changes

01 Aug 2016, 15:27

You a correct. However, since this topic is about Ahk2Exe I assumed you wanted ahk2exe (the compiler) to do something about this "constants" issue. Otherwise, it would be better to discuss this here: about why AutoHotkey doesn't have them.

Inno Setup is somewhat easier to use than NSIS, but can be a little bloated due to its "ease".

You're completely right, but you know what I mean. ;) that said, if you know fincs and how it is developing open source projects he means "hiatus, hiatus, hiatus". I am guilty of this, so are many other opensource devs. :P
Daniel Beardsmore
Posts: 11
Joined: 23 Jul 2016, 15:57

Re: Upcoming Ahk2Exe changes

01 Aug 2016, 16:29

Well, here goes nothing …
real_Napster
Posts: 32
Joined: 19 Jan 2016, 13:43
Location: Germany

Re: Upcoming Ahk2Exe changes

10 Nov 2016, 12:26

Has or will this ever become a final version?
In the actual ahk2exe that comes with latest autohotkey installer the ";@Ahk2Exe"-commands aren't working.. :(

I replaced my ahk2exe with the preview 2a from this thread, but it would be awesome if this would work by default. :think:

Return to “Announcements”

Who is online

Users browsing this forum: No registered users and 1 guest