Execute script dynamically with a script's converted exe? Topic is solved
-
- Posts: 493
- Joined: 03 Dec 2018, 20:02
Execute script dynamically with a script's converted exe?
Is it possible to execute a script file or code with the compiled script's exe? Passing parameters to run .ahk files just like the AutoHotkey binary?
Re: Execute script dynamically with a script's converted exe?
Yes, you can write your own interpreter and compile it!
You can rename AutoHotkey.exe to something else, give your AHK script file the same name with .ahk extension, put the two files in the same directory, and then run the renamed EXE file.
Also this capability: https://www.autohotkey.com/docs/Scripts.htm#ahk2exe-base
You can rename AutoHotkey.exe to something else, give your AHK script file the same name with .ahk extension, put the two files in the same directory, and then run the renamed EXE file.
Also this capability: https://www.autohotkey.com/docs/Scripts.htm#ahk2exe-base
[v1.1.34+]: The standard AutoHotkey executable files can also be used as the base of a compiled script, by embedding a Win32 (RCDATA) resource with ID 1. This allows the compiled script .exe to be used with the /script switch to execute scripts other than the main embedded script. For more details, see Embedded Scripts.
-
- Posts: 493
- Joined: 03 Dec 2018, 20:02
Re: Execute script dynamically with a script's converted exe?
@mikeyww Thanks! Using the /script switch to make the compiled script exe execute scripts other than the main embedded script sounds exactly what I needed. However when I try to select an exe for the base file it says the exe is invalid, any ideas?
Re: Execute script dynamically with a script's converted exe?
I actually never tried this, just saw the documentation. You might need to follow what is in "Embedded Scripts", step by step. Others here may know the trick.
Re: Execute script dynamically with a script's converted exe? Topic is solved
@william_ahk
If you are using the latest beta Ahk2Exe from here (which was originally compiled with the test version of AutoHotkey 1.1.34.00) you can compile your first script using Ahk2Exe.exe itself as the base file. You can then use this .exe with the /script parameter to run another script. Unfortunately this is U32 only.
If you need U64 then you will need to download the test version of AutoHotkey 1.1.34 from here and use the extracted AutoHotkeyU64.exe as the base file for your compile, still using the beta version of Ahk2Exe mentioned earlier. The /script parameter can then be used with the resulting .exe.
Cheers
If you are using the latest beta Ahk2Exe from here (which was originally compiled with the test version of AutoHotkey 1.1.34.00) you can compile your first script using Ahk2Exe.exe itself as the base file. You can then use this .exe with the /script parameter to run another script. Unfortunately this is U32 only.
If you need U64 then you will need to download the test version of AutoHotkey 1.1.34 from here and use the extracted AutoHotkeyU64.exe as the base file for your compile, still using the beta version of Ahk2Exe mentioned earlier. The /script parameter can then be used with the resulting .exe.
Cheers
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
-
- Posts: 493
- Joined: 03 Dec 2018, 20:02
Re: Execute script dynamically with a script's converted exe?
@swagfag @TAC109 Thank y'all!