AHKv2.0 Ahk2Exe

Discuss the future of the AutoHotkey language
_3D_
Posts: 205
Joined: 29 Jan 2014, 14:40

AHKv2.0 Ahk2Exe

21 Jan 2015, 12:59

Is there some official BIN ver.2.0 that can be used with Ahk2Exe ?
OR
Guide me How To make BIN from AutoHotkey.exe ?
Thanks.
AHKv2.0 use the future now.
HotKeyIt
Posts: 1792
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHKv2.0 Ahk2Exe

21 Jan 2015, 13:09

There is Ahk2Exe and bin files for AHK_H v2 and AFAIK it is 100% compatible to AHK v2.
_3D_
Posts: 205
Joined: 29 Jan 2014, 14:40

Re: AHKv2.0 Ahk2Exe

21 Jan 2015, 13:54

HotKeyIt wrote:There is Ahk2Exe and bin files for AHK_H v2 and AFAIK it is 100% compatible to AHK v2.
I cant find Util_ library for Compiler.ahk.
AHKv2.0 use the future now.
HotKeyIt
Posts: 1792
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHKv2.0 Ahk2Exe

21 Jan 2015, 14:30

There is no Util_ library, the only Util_ functions used are Util_Error() defined in Ahk2Exe.ahk and Util_GetFullPath() defined in Compiler.ahk.

You will need AHK_H v2 executable to run compiler (Ahk2Exe.ahk):
1. extract all content to a folder
2. copy AutoHotkey.exe to compiler folder
3. rename AutoHotkey.exe to Ahk2Exe.exe
4. run Ahk2Exe.exe
_3D_
Posts: 205
Joined: 29 Jan 2014, 14:40

Re: AHKv2.0 Ahk2Exe

21 Jan 2015, 15:54

I do exactly steps
in addition I copy standard ahk scripts from Lib folder to Compiler\Lib
AutoHotkey.exe (2.0-a056-33fe326 / Unicode / x86) default AutoHotkey.exe

Ahk2Exe.ahk line 439

Code: Select all

#DllImport,HtmlHelp,hhctrl.ocx\HtmlHelp,PTR,,Str,,UInt,,PTR,
VarSetCapacity(ak, ak_size := 8+5*A_PtrSize+4, 0) ; HH_AKLINK struct
,NumPut(ak_size, ak, 0, "UInt"),name := "Ahk2Exe",NumPut(&name, ak, 8)
,HtmlHelp(GuiHwnd, helpfile, 0x000D, &ak) ; 0x000D: HH_KEYWORD_LOOKUP
I correct it to:

Code: Select all

DllImport,HtmlHelp,hhctrl.ocx\HtmlHelp,PTR,,Str,,UInt,,PTR ;<< remove # (begin) and coma(end)
,VarSetCapacity(ak, ak_size := 8+5*A_PtrSize+4, 0) ; HH_AKLINK struct  << add leading coma
,NumPut(ak_size, ak, 0, "UInt"),name := "Ahk2Exe",NumPut(&name, ak, 8)
,HtmlHelp(GuiHwnd, helpfile, 0x000D, &ak) ; 0x000D: HH_KEYWORD_LOOKUP
Now
IconChanger.ahk line 28

Code: Select all

UpdateResource(re, 3, ids[A_Index], 0x409) ;<< function missing
Ill keep tracing the code - till it run :P
AHKv2.0 use the future now.
HotKeyIt
Posts: 1792
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHKv2.0 Ahk2Exe

21 Jan 2015, 16:07

You are using wrong AutoHotkey.exe, you need to use AHK_H v2 (download), version should be showing 2.0.0.0.
_3D_
Posts: 205
Joined: 29 Jan 2014, 14:40

Re: AHKv2.0 Ahk2Exe

21 Jan 2015, 16:40

In ahkdll-v2-release-master.zip function UpdateResource missing too :(
Only call of the function and no definition in any ahk file.
AHKv2.0 use the future now.
HotKeyIt
Posts: 1792
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHKv2.0 Ahk2Exe

21 Jan 2015, 17:24

It is included in exe, see WinApi :)
Create AutoHotkey.ahk in Win32w folder and double click AutoHotkey.exe, no error

Code: Select all

UpdateResource()
_3D_
Posts: 205
Joined: 29 Jan 2014, 14:40

Re: AHKv2.0 Ahk2Exe

21 Jan 2015, 19:01

Thanks - now It started.
I copy Autohotkey.exe from .\Win32w to .\Compiler and rename it to Ahk2Exe.exe also copy AutoHotkeySC.bin to .\Compiler
Still not tested but when started it will work.
Thanks again.
AHKv2.0 use the future now.
egocarib

Re: AHKv2.0 Ahk2Exe

15 May 2015, 09:29

I've been experimenting with this method to compile AHKv2 scripts. It has worked for some simple scripts. However, I am running into an issue with a script that uses the following code:

Code: Select all

	thisClass := WinGetClass("A")
	thisWindowTitle := WinGetTitle("A")
	thisWindowID := WinGetID("A")

	Dbg.Out("winClass=%thisClass% winTitle=%thisWindowTitle% winID=%thisWindowID%")
This script runs fine uncompiled (as an .ahk script) using both the AHKv2 and the AutoHotkey_H executables. However, when I compile this script using the method described above (renaming the AutoHotkey_H executable to Ahk2Exe.exe) the compiled script does not work. WinGetClass and WinGetTitle both fail to work and return empty strings in the compiled version (WinGetID still works).

Any idea what would cause this issue in the compiled executable, or if there's a way to fix it?
egocarib

Re: AHKv2.0 Ahk2Exe

20 May 2015, 20:55

Anyone have any thoughts about this, or suggestions for how I can compile my script? Do I need to provide more information?

I did a completely fresh reinstall of AutoHotkey_H to make sure I wasn't mixing any resources from other versions of AHK, and I am still not able to compile my scripts. The scripts run fine when I run them as .ahk through the AutoHotkey_H executable, but when I compile them they don't work anymore, usually because various kinds of functions are returning empty strings, even though they worked fine before compilation.

Otherwise, does anyone know how I can compile AHKv2 scripts another way? Perhaps by creating a BIN for AHKv2? I don't know how to do that, but I'm willing to do the heavy lifting if someone can point me in the right direction. I'm hoping this isn't a dead end.. I could refactor the entire script to work in AHK version 1 so that it's compilable, but that's a lot of work and will make the code a lot uglier just so it can compile :(
HotKeyIt
Posts: 1792
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHKv2.0 Ahk2Exe

21 May 2015, 00:22

I can confirm this is a bug but I have not found a solution yet.
You can compile your scripts using AutoHotkey.exe with included compiler, only AutoHotkeySC.bin has got that bug as far as I know.
HotKeyIt
Posts: 1792
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHKv2.0 Ahk2Exe

22 May 2015, 16:16

This should be fixed now, download AutoHotkey_H v2 alpha and try again :)
egocarib
Posts: 99
Joined: 21 May 2015, 18:21

Re: AHKv2.0 Ahk2Exe

22 May 2015, 20:13

Nice! It works. :D

Thanks for helping to fix it - that's going to be extremely useful.
HotKeyIt
Posts: 1792
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHKv2.0 Ahk2Exe

23 May 2015, 07:40

I have implemented a proper fix after explanation from Lexikos, I would reccomend to redownload AutoHotkey_H v2 alpha.
egocarib
Posts: 99
Joined: 21 May 2015, 18:21

Re: AHKv2.0 Ahk2Exe

09 Mar 2016, 16:04

I ran into another issue with this compiler recently (at least, I think it's the compiler - perhaps it could be a v2 bug?).

The new function version of FileInstall does not work correctly. It ends up creating a 0KB file in the destination path.

However, the old command version of FileInstall still works as expected - I fixed the bug by going back to the old command syntax, and things now work as expected.


Code that does not work (generates an empty 0KB bmp file at the destination when the program is run):

Code: Select all

FileInstall("binoc.bmp", "%A_AppData%\TT\binoc.bmp", 1)
Code that works as expected:

Code: Select all

FileInstall, binoc.bmp, %A_AppData%\TT\binoc.bmp, 1
HotKeyIt
Posts: 1792
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHKv2.0 Ahk2Exe

10 Mar 2016, 06:22

I have adapted Ahk2Exe for v2 and AutoHotkey v2\Compiler to accept FileInstall("...", "...").
egocarib
Posts: 99
Joined: 21 May 2015, 18:21

Re: AHKv2.0 Ahk2Exe

21 Oct 2016, 14:29

Hey HotKeyIt,

Can you please explain how to set up the compiler again? I'm trying to update to the newest version you've put out, but I can't get it to work. This is what I tried:

1. Download the package https://github.com/HotKeyIt/ahkdll-v2-r ... master.zip
2. Copy AutoHotkey.exe from the Win32w directory into the Compiler directory, and renamed it Ahk2Exe.exe
* I also tried copying AutoHotkey.exe from the 64 bit directory when this one didn't work.
3. Tried to compile script. There doesn't appear to be a BIN included in the package anymore, so I tried selecting all the other options from the Base File (.bin) dropdown menu instead (I tried the 32 & 64 bit AutoHotkey.exe and also the Autohotkey.dll files. When those didn't work, I also tried copying over my old AutoHotkeySC.bin and using that as a .bin file, but that doesn't seem to work either when I try to compile a script)

I can still compile with my old version of Ahk2Exe and AutoHotkeySC.bin, so I'm not sure what I'm doing wrong trying to set up the newer files. Any help is appreciated. Thanks!
HotKeyIt
Posts: 1792
Joined: 29 Sep 2013, 18:35
Contact:

Re: AHKv2.0 Ahk2Exe

21 Oct 2016, 15:49

What do you mean by 'that doesn't seems to work'.
AutoHotkey_H v2 has not got a ..SC.bin file anymore because some features do not work here and I don't see the need for it.
  • What script do you try to compile?
  • Is the exe created?
  • Do you get any errors?
  • Did you try to compile a simple script?
egocarib
Posts: 99
Joined: 21 May 2015, 18:21

Re: AHKv2.0 Ahk2Exe

21 Oct 2016, 16:09

Hmm. I'm going to need to investigate a bit, I guess. I got it to work with a simple script.

The script I was trying to compile is several thousand lines long, so I'm not sure what the source of the issue is. The main hotkeys for that script don't appear to be working at all when I compile the script with the most recent version of your compiler. It works fine when I compile with the old .bin file and old version of AHK_H from 2015, though. I'll let you know if I can pin down the problem.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 0 guests