10-20-2024, 09:58 AM
On Discord, we were talking about various things (as usual -- all you guys are invited to join us there!), and the topic came up about how to retrieve the source code from the EXE. With the new embedding commands, it's simple as heck to embed the BAS source into your program and then retrieve it and restore it later.
For example, something as simple as this works for us:
We have now added a command line paramater to the EXE which is trigged by "-SOURCE", and which dumps the source file to the drive for us.
It doesn't get much simpler than this.
Feel free to make use of this style code for any/all of your own progams where you might want to store the source with the EXE for future reference/retrieval.
For example, something as simple as this works for us:
Code: (Select All)
'Step One: Embed the source code into your EXE
$Embed:'MyProgramName.Bas','sourcehandle'
'Step Two: Assign a variable to represent the source code
source_code$ = _Embedded$("sourcehandle")
'Step Three: Write a simple routine to retrieve the source
c$ = UCase$(Command$)
If c$ = "-SOURCE" Then
Open "MyProgramName.tmp" For Output As #1 'so you don't overwrite the original source while testing
Print #1, source_code$
Close #1
System
End If
We have now added a command line paramater to the EXE which is trigged by "-SOURCE", and which dumps the source file to the drive for us.
It doesn't get much simpler than this.

Feel free to make use of this style code for any/all of your own progams where you might want to store the source with the EXE for future reference/retrieval.