Passing Command Line Parameters to a Script
[v1.1.33+]: The switch /e can be used to specify a script which should be executed instead of the embedded one.
Could this not be implemented with minimal effort?
(No comparison for example with the introduction of asterisk:
[v1.1.17+]: Specify an asterisk (*) for the filename to read the script text from standard input (stdin).)
Wouldn't that be an enormous improvement of the usage possibilities (for a part of the users)?
ED: A fun without risk & cost! (?)
newbieforever wrote: ↑28 Apr 2020, 03:22I don't have the deeper knowledge and competence to really judge this (old) question. Nevertheless:
(I) In AHK_L there are still two interpreter executables used, AutoHotkey.exe and AutoHotkeySC.bin. The reason for this duality in grey prehistoric times was probably that the BIN used for compilation is leaner. But the difference between EXE and BIN today is only 882 vs 817 kB, for compressed files 372 vs 336 kB (U32 in 1.1.32). That doesn't make sense anymore, does it?!
(II) To launch compiled scripts (i.e. AutoHotkeySC.bin) command lines must have the following structure:
CompiledScript.exe [Switches] [Script Parameters]
It would be, I think, so easy for Lexikos & Co. to slightly change a tiny spot in the source code by inserting really only a few simple lines, which would allow the use of an additional (optional) switch:
CompiledScript.exe [/scr:Script Filename] [Switches] [Script Parameters]
I believe that the (so far) usual use of AutoHotkey would not be influenced by this in any way. However, it would be possible to use any compiled script as an interpreter to execute any script!!!
The only thing that would have to be changed in the source code would be that if /scr:... is used in the command line, the interpreter should not process the embedded script, but the script specified in the CL (as in the case of AutoHotkey.exe).
But I know everyone here will immediately cry out that there is absolutely no need for this. Do you think so too, HotKeyIt?
newbieforever wrote: ↑28 Apr 2020, 05:50Thanks a million, HotKeyIt!
Forgive me for seeking further approval from you:
- Wouldn't that be an enormous improvement of the usage possibilities (for a part of the users)?
- Wouldn't this be possible without any disturbance of the usual usage?
- Wouldn't that be possible with minimal effort? (If the source code was written in AHK, even I would be able to do it. (1) Identify the switch /e or /scr in the CL. (2) Read not the embedded file, but the one specified in the CL.)