I have always wanted a way to pack files into a script for portability but I have never been able to find one.
That came to this:
Store virtually any file in a .ahk script (or compiled .exe)
Download: Here
Current version: 2.6
Compatible with: AHK Basic, AHK L ANSI, AHK L Unicode (X86/X64)
File types i've tested and know work: .zip, .exe, .txt, .ahk, ...anything?
The .ahk size of the file is rougly 1.33x the normal filesize(s). The compiled .exe (without compression) is rougly 1-1.05x the included filesize(s).
If you find any bugs or have anything to suggest please feel free to post.
How to use!:
1. Download and save the .ahk to a directory of your choosing.
2. Run the script
3. Select a file you want to include with your script(s)
4. Enter a name for the function you call to recreate the file (valid function names only)
5. Wait for it to do its stuff
6. Answer the questions on how you want to save the script
7. Simply include the code via #include or pasting it into your script
8. Call the function with Extract_*name* and the path/name of the file you want it to save as and it will recreate the file

Include virtually any file in a script (exe/zip/dll/etc....)

few ideas:
[*:30n3qw03]for the function that 'extracts' the file, you should have it has Blah_extract(....).
[*:30n3qw03]Documentation and/or samples.
[*:30n3qw03]maybe have 3 options for _get(...):
[*:30n3qw03] size
[*:30n3qw03] name (file.ext)
[*:30n3qw03] path (everything else)[/list]

rawr. be very afraid
*poke*
. Populate the AutoHotkey city. Pointless but somewhat fun. .
great script!
few ideas:
[*:3s3eshhr]for the function that 'extracts' the file, you should have it has Blah_extract(....).
[*:3s3eshhr]Documentation and/or samples.
[*:3s3eshhr]maybe have 3 options for _get(...):
[*:3s3eshhr] size
[*:3s3eshhr] name (file.ext)
[*:3s3eshhr] path (everything else)[/list]
Good ideas

I've updated it and changed the following:
*Function_Name*_Get(...) now has the following options:
Size (Size in bytes of the source file)
Name (Name + extension of the source file "name.extension")
Extension (Extension of the source file if any - "extension")
Directory (Directory of the source file - "C:\my folder")
The created function is now created as *Function_Name*_Extract(...)
I will be making a few examples shortly after I eat supper


With this in mind, is it possible to include an actual folder with an EXE file in it? If it is, can these be extracted anywhere when the script is run?

If it's a single exe you want to include you can do that without any problems.
You can tell the function to extract the files to any location you choose.

Pardon my reasoning skills lol it's the best way I know to understand new cool things

Is there maybe a function you could add to capitalize on 7zip or Winrar to compress the #$%$ out of all the included files together, so they are an archive which is smaller for the FileInclude operation? Then the unpack location could be set with the variables made when you included the files. That may make the resulting script noticeably smaller. You could have a checkbox for the user to optionally choose that option if they have Winrar or 7zip installed on their system.

hello,
I am deeply sorry for bumping this old thread, but I just had to tell you, that this is the most epic shit I have come across in these forums.
I love you.
Have a nice day

hello,
I am deeply sorry for bumping this old thread, but I just had to tell you, that this is the most epic shit I have come across in these forums.
I love you.
Have a nice day
Thanks it's always nice to know someone's using the random stuff I write.

Too bad i missed it 2 years ago! Amazing very well done!
Thanks Rseding91

winXP and ahk unicode
Yes,
Big Kuto to Rseding91. I too found this program cool and quite useful. In a ridiculous and illogic thought, I did multiple wrapping/layers as kind of protection. I can further again wrap the y.exe into an installer, or simply pack it in the final the final CD usable as Windows program product. The client or receiver runs the y.exe and get the x.exe, the main program.
Thanks for your hard yet genius work
-p

I am missing something. I have been trying for an hour to extract a file to my desktop. I know that it says to is Extract_*name* to call the file up, but I can't figure out the code to send it to a specific directory. I'm sure it's something minute that I am missing.

destination=c:\temp\test.png Extract_myimage(destination)

winXP and ahk unicode
Updated to 2.4
- Cleaned up the main script - reduced the file size by 2.7%, and made it truly basic/ANSI/Unicode/32 bit/64 bit compatible
- Cleaned up the output function - reduce the file size by 4.6% and reduce the number code lines (48 lines vs. 60 lines)

Updated to 2.5
- Cleaned up the main script again - reduce the file size by 10x and reduce the encode time by 50%
- Cleaned up the output function again - reduced the file size and line count slightly - no performance difference over 2.4

.....that this is the most epic shit I have come across in these forums.......
Exactly what I was thinking. Thank you Robert Eding!
EDIT : Further usage made me realise that all variables are static, and that can cause memory problems if I have many functions to extract the files. Removing static causes loss of functionality, any idea how to avoid the variables?
I currently use a temporary workaround. The extract functions empty the static variables once they are complete. This can be done as I use the functions only once in my script.

Abandon the forum. The community has decided in a democratic vote to leave this website because of inactive and perverse administration.
Very few of the contributing members remain here.