Jump to content

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

How to Compile .ahk to .exe without embodying autohotkey.e


  • Please log in to reply
7 replies to this topic
piglet
  • Members
  • 4 posts
  • Last active: Oct 08 2009 01:18 AM
  • Joined: 05 Oct 2009
My question is "How to Compile .ahk to .exe without embodying autohotkey.exe", the subject was shortened by the forum limit.
In my program, I used .ahk as sub-programs when needed. In order to protect my source code, the easy way is to compile them into .exes. I know this can be done by ahk2exe.exe or sth. else. But, in this way, autohotkey.exe was also embodied in the .exe file, which makes the .exe file very big. If there is only one .ahk, that is ok, but I have about twenty, if every .exe file embodies autohotkey.exe, that is very big and too wasted. I want to put autohotkey.exe in one folder, and simply compile .ahk to .exe without embodying autohotkey.exe, when executing, run the .exe via autohotkey.exe appointed.
Is it possible? And how?
Thanks, my English is not good enough to explain clearly.

Leef_me
  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 AM
  • Joined: 08 Apr 2009

Thanks, my English is not good enough to explain clearly.

You need not apologize. I have seen many whose native tongue is English, but write less clearly than you.

In order to protect my source code, the easy way is to compile them into .exes. . . . But, in this way, autohotkey.exe was also embodied in the .exe file, which makes the .exe file very big. If there is only one .ahk, that is ok, but I have about twenty, if every .exe file embodies autohotkey.exe, that is very big and too wasted.

Have you considered combining several scripts into one AHk source file?
If you can, the overhead of "embodying autohotkey.exe" would be reduced.

As far as size goes, many Ahk programs are very small, typically 200K on the harddrive. I just looked and Notepad.exe is 148K and control panel is >200K.

There is something suggesting a slight reduction in size if you look here;
search for the phrase "Compiled scripts can be reduced in size by about 20 KB"

<!-- m -->http://www.autohotke...pts.htm#ahk2exe<!-- m -->

Compiling adds the interpreter of Ahk to your script. I believe your script is actually interpreted, or compiled just before run time.

piglet
  • Members
  • 4 posts
  • Last active: Oct 08 2009 01:18 AM
  • Joined: 05 Oct 2009
Thank you, Leef_me.
Of course I know the compile tool you mentioned, and I am sure you have understood what I had said.
You are right, maybe I should change my mind to reorganize my scripts. That's the best way.
Thank you for encouraging me, my English has been rusty for about 6 years.

Leef_me
  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 AM
  • Joined: 08 Apr 2009
Just a crazy thought.

If you are that concerned about "protecting source code" why not develop another file format?
What about a new file type *.ahp that has the script password encoded.
The associated program is your script that decodes the file and gives it to AHK to run.

piglet
  • Members
  • 4 posts
  • Last active: Oct 08 2009 01:18 AM
  • Joined: 05 Oct 2009
:lol:
I'm interested in your crazy thought!!
But how?
And I admit that's what I had thought to try.
One way I had thought was to embody some decryption code in the main exe file, as 123.exe for example. If 456.ahk was one of the .ahks to be called by 123.exe, encrypt 456.ahk to 456-e.ahk, delete 456.ahk or put it somewhere else ( not to be seen by user anyway). When 123.exe called, firstly write out the decryption code from 123.exe, decrypt 456-e.ahk to 456.ahk using the decryption code, attribute +h 456.ahk, run 456.ahk, encrypt 456.ahk to 456-e.ahk again, then delete 456.ahk and the decryption code.
That's too complicated and I don't like to write and delete and write and delete and ......
If there's no good way, I decide to leave it open source, :lol: Or just to change .ahk to .dll, the easiest and simpliest way to "cheat" people. .dll will lower people's curiousity and the frequency to be opened by Notepad.exe. :wink:

---
Edit #1:
I'd better write out 456.ahk rather than the decryption code. :wink:

Z_Gecko
  • Guests
  • Last active:
  • Joined: --
encryption:
http://www.autohotke.../topic6804.html

running an ahk-script WITHOUT creating a file:
http://www.autohotke...topic25867.html
http://www.autohotke...topic49027.html

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Rather than explicitly encrypting the scripts, you could FileInstall them in the main compiled script; they would then be encrypted and compressed using the same method as is used for the script itself. FileExtract_ToMem can be used to extract each script without writing anything to disk.

piglet
  • Members
  • 4 posts
  • Last active: Oct 08 2009 01:18 AM
  • Joined: 05 Oct 2009
Thx 4 everybody.
U all posted very intelligent ideas, I need much time to digest them! :wink: