Jump to content

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

Compile_AHK - for those who compile!


  • Please log in to reply
17 replies to this topic
nick
  • Members
  • 549 posts
  • Last active: Jul 03 2010 09:31 PM
  • Joined: 24 Aug 2005
This thread is continued at

:arrow: http://www.autohotke...pic.php?t=22975

THX, ladiko and good luck!




Update on 2007-06-24:
Removed buggy version check for /NoDecompile


Update on 2007-03-24:
Support for AHK's 1.0.46.10 new compiler parameter /NoDecompile


Update on 2007-02-17:
Fixed bug on paths containing spaces



This thread was originally posted in the German Forum at http://de.autohotkey...topic.php?t=771. AGU was so kind to translate it, so it can be posted in the mother of forums now:

When I started to use AHK and AU3 I chose AU3 as my primary scripting language because I liked the syntax, the SciTe integration and some additional integrated functions which make your life easier. Then I had an AU3 tool which barely ran on my own Athlon 2600+ but had a response time of several seconds on the Celeron600 PCs at work in my company. So I started the difficult task and ported it to AHK and guess what - it ran like a charm even on those old machines. Since that time I used AU3 very rarely.

My tools/programs are always distributed as compiled Exe. That's why I always missed the AU3 option 'Compile with Options'. Additionally I recently discovered Thalons AHK Icon Changer and thought, if you want to have it, write it on your own. So I asked Thalon for permission to use his code and wrote the 'Compile_AHK' script:

Posted Image

Posted Image

What is it good for?

Compile_AHK handles all compiler options and version information within the script's own directory in a file named Scriptname.ahk.ini. Set once, they will be read out on every run, displayed and can finally be change at wish. After settings are done once all that changes during compiling is the displaying of the GUI and the need to press 'Return' one more time.

What do you need?

Download the Compile_AHK_Setup.exe from https://ahknet.autoh...e_AHK_Setup.zip. The setup includes Compile_AHK.exe, GoRC.exe and ResHacker.exe. They will be installed into your 'Compiler' subfolder of your Autohotkey installation folder. I chose that way instead of copying the files somewhere else and checking the paths by reading the registry every time of execution. Additionally the action "Compile with Option" can be added to the AHK files context menu for calling Compile_AHK easy. If you want to have a look before, you can find the Compile_AHK_Setup.ahk script at https://ahknet.autoh...e_AHK_Setup.ahk.

If you prefer to do it on your own, download the script fom at https://ahknet.autoh...Compile_AHK.ahk. After this you need GoRC.exe and the ResHacker.exe from http://www.autohotke...7121.html#77121. ResHacker.exe can be packed with UPX.exe --best Reshacker.exe if you like. After that you have to compile Compile_AHK.ahk. Copy Compile_AHK.exe, GoRC.exe and ResHacker.exe in your 'Compiler' subfolder of your Autohotkey installation folder.

Finally you may switch the calling of Ahk2Exe from within the editors to Compile_AHK.exe. Please pay attention that only /in parameter and the full script path will be passed over.

How does it work?

At first start and on every version change, the file AutoHotkeySC.bin will be saved within the 'Compiler' subfolder as AutoHotkeySC.bin.org. In order to enter the version information it will be recreated from the backup copy. After compiling it will be restored again.

Compiler options will be passed to Ahk2Exe.exe as commandline parameters if possible. Compression will be achieved by setting the registry value HKCU\Software\AutoHotkey\Ahk2Exe\LastCompression. Because Ahk2Exe automatically uses the LastIcon entry for the icon, it will be deleted before and after calling the GUI.

If "Set Version Info" is selected, the version info values are added temporary to AutoHotkeySC.bin by calling GoRC.exe and ResHacker.exe before compilation.

For the Run Before/After calls you may use the placeholders %IF%, %OF%, %OD% and %ON%. Before execution they will be replaced as:
%IF% = script file's full path, %OF% = exe file's full path, %OD% = exe file's directory, %ON% = exe file's name.


So give it a try! I hope, you'll like it! :D
nick :wink:

ecksphore
  • Members
  • 252 posts
  • Last active: Jul 20 2015 03:25 AM
  • Joined: 21 Nov 2006
I get a "command line parameter error" when loading it.

It says : Wrong number of parameters : 0

nick
  • Members
  • 549 posts
  • Last active: Jul 03 2010 09:31 PM
  • Joined: 24 Aug 2005

I get a "command line parameter error" when loading it.

It says : Wrong number of parameters : 0


You can't use it on its own without the command line parameters /in scriptfile_full_path.

Did you try the "Compile with Options" context menu entry?
nick :wink:

ecksphore
  • Members
  • 252 posts
  • Last active: Jul 20 2015 03:25 AM
  • Joined: 21 Nov 2006
I didn't get any GUI at all .. just that error message.

nick
  • Members
  • 549 posts
  • Last active: Jul 03 2010 09:31 PM
  • Joined: 24 Aug 2005
I wasn't at home the last two days so I couldn't answer.

Wrong number of parameters : 0

means, that there is no (zero) command line parameter.

So I have to ask again: How do you start the Comple_AHK.exe?
nick :wink:

TeeTwo
  • Members
  • 125 posts
  • Last active: Jun 09 2014 12:54 AM
  • Joined: 29 Dec 2006
I like your program and when trying to compile using other options
just selecting the script file plus an icon file
when I compile I get compilation error

am I missing something. I like how it is a hard stay on top and easy gui.
love to get it to work.
It created Prog.ahk.ini
OUT_FILE=E:\Monitor\Prog.exe
OUT_ICON=
UPX_LEVEL=2
OUT_PASS=
RUN_BEFORE=
RUN_AFTER=
[VERSION]
VERSION_INFO=0

But no new exe

?
(The guy from Oz)

Jero3n
  • Members
  • 147 posts
  • Last active: Mar 31 2010 05:07 PM
  • Joined: 19 Jan 2007
i try to use it, but i get the same error as nick... can you help us??

nick
  • Members
  • 549 posts
  • Last active: Jul 03 2010 09:31 PM
  • Joined: 24 Aug 2005
Sorry, but a can't reproduce the error.

So, what\how did you install where?

How do you start the Compile_AHK.exe?

Are there any additional messages in Compile_AHK.log in AHK's Compiler directory?

:?:
nick :wink:

TeeTwo
  • Members
  • 125 posts
  • Last active: Jun 09 2014 12:54 AM
  • Joined: 29 Dec 2006
I downloaded the file and accepted the standard installation. I right click on a ahk file and choose compile with options and get the compiler error message.

Using ahk2exe.exe I do not have a problem
(The guy from Oz)

twhyman
  • Members
  • 348 posts
  • Last active: Sep 17 2014 01:55 AM
  • Joined: 07 Dec 2005
same here i get a GoRC.exe related error... :(

nick
  • Members
  • 549 posts
  • Last active: Jul 03 2010 09:31 PM
  • Joined: 24 Aug 2005
Sorry, I'm just on the way into holidays without any internet connection. I'll come back on 2007-02-15 and will try to find out, what's wrong!

So long!
nick :wink:

DJAnonimo
  • Members
  • 171 posts
  • Last active: Apr 30 2013 01:20 AM
  • Joined: 10 Sep 2006
Hi nick

your compiler supports just first icon change... not like AHKIconChanger...?

nick
  • Members
  • 549 posts
  • Last active: Jul 03 2010 09:31 PM
  • Joined: 24 Aug 2005
Hi,

it should be done. Seems to be the everlasting problem with path names containing spaces. In german versions of windows "Program files" is called "Programme", no space at all. But I wonder, why it wasn't noticed earlier.

I updated Compile_AHK_Setup.zip and Compile_AHK.ahk script. So give it a try!


@DJAnonimo:
Compile_Ahk is a wrapper for Ahk2Exe with additional support for version informations. The icon file is passed to Ahk2Exe and Ahk2Exe accepts only one. I know the AHK Icon Changer and parts of the script are taken from it. But I think that using Compile_AHK is a little bit easier.
nick :wink:

Elevator_Hazard
  • Members
  • 297 posts
  • Last active: Feb 07 2011 12:10 AM
  • Joined: 28 Oct 2006
For that icon does it use A_WorkingDir if it finds a relation in paths? that's what I need, or does it store it some other way?
Changed siggy at request of ahklerner :D

nick
  • Members
  • 549 posts
  • Last active: Jul 03 2010 09:31 PM
  • Joined: 24 Aug 2005

For that icon does it use A_WorkingDir if it finds a relation in paths? that's what I need, or does it store it some other way?

The icon file may be stored anywhere. Once selected within the gui, it's path is stored in scriptname.ahk.ini in the script's folder.
nick :wink: