1

I just created a tiny but useful project using AutoHotKey and PHP, and I would've like to distribute it for free on the internet.

The project is made using two files:

  • myproject.ahk gets triggered when I press a specific shortcut, does some preliminary operations and then calls myproject.php using the Run command
  • myproject.php takes some parameter from myproject.ahk from the command line and does some further operations such as a cURL request

I would like to distribute this project as an executable file, but I don't know how. Converting an AHK file to EXE is easy due to the integrated AutoHotKey GUI, while I found some online tools like php-compiler.net that can convert an interpreted language to a binary file.

But how to make a unique executable file? Should I build them separately and then merge them somehow?

Thanks in advance.

Shish
  • 13
  • 3
  • It might be possible to run the CURL directly from AHK using the [`LibCurl for AHK`](https://www.autohotkey.com/boards/viewtopic.php?t=79127) library to bypass the need for the 2nd php script – Spyre Jun 05 '21 at 16:45
  • Why not distribute the two files together as a bundle ? I think no one will mind to have an application containing more than one file. – Ken Lee Jun 05 '21 at 16:46
  • @Spyre that's not for me... I do not just perform a cURL request using PHP but also some different operations which are difficult (if not impossible) using AHK. Thanks anyway! – Shish Jun 05 '21 at 16:49
  • @KenLee yeah, I could... But I've never seen something like this. Even if it is developed using many different languages, most of the program are distributed using a single executable file, or an `exe` and some `dll`s. I would like to learn how to do that. – Shish Jun 05 '21 at 16:52
  • If I were you I will put the main EXE in the application folder and then put the PHP's EXE in a subfolder under the application folder (say make the subfolder to have name such as support_files) so that it will not appear to be too ODD and the user will run the main EXE instead of the PHP's EXE file. – Ken Lee Jun 05 '21 at 17:16
  • You might be able to do it with the built in Windows iexpress tool – Spyre Jun 05 '21 at 23:41
  • @KenLee thank you very much! Could changing the file extension be a good idea (the file would work anyway since it is called from the command prompt)? What extension should I use in that case? – Shish Jun 06 '21 at 19:50
  • @Spyre good idea... let me try – Shish Jun 06 '21 at 19:51
  • @Spyre the Windows iExpress tool didn't work... It allows me to extract my files but keeps the two executables separate. I'm open to other suggestions. – Shish Jun 13 '21 at 11:18

1 Answers1

0

Just use FileInstall. I have a similar need to yours and I think it's possible to include a random.exe into your ahk.exe as a resource and run without extracting to disk, but a couple of hours of googling "persuaded" me to use FileInstall, because the alternative will probably look like this. Yeah, I don't know what I am looking at.

If you don't want to confuse your users with strange executables that appear out of nowhere, have your php.exe extracted to a temp folder.

FileInstall, % A_ScriptDir "\php.exe", % A_Temp "\php.exe", true
Run, % A_Temp "\php.exe " arg1 " " arg2 
Eli
  • 182
  • 1
  • 2
  • 12