Sure, you can customize the templates. You are not out of line, as I assumed that users would like to customize the templates, from the very beginning.
This is how CMenu 1.6 does this.
It installs the template files into
Program Files\CMenu\Templates. The text files are read by Identify Installer and the au3 files are read, when you create an AutoIt script.
If example Inno Setup is identified, and you want to create a script, then the
Inno_Setup.au3 will be read. A file called
Common_Functions.au3 will also be read, for any installer. The data will be checked for the strings,
Program_name and
filename.ext, and will be replaced by, for example
NOD32 v2.50.25 and
NOD32 v2.50.25.exe. If a recording was made of the installation, then the recorded files could be read. The variables at the top of the script may have the information added to them. The script is then created in the installers directory. That is the script making process.
Now, as Identify Installer reads these files, then if you make change to the files, in the templates folder, the output would be what you have changed them to. If you want no common functions for the scripts, then clear the code from the
Common_Functions.au3, so when it is read, nothing is returned. Now you may want to customize the Inno Setup output, so you would open the
Inno_Setup.au3, in your editor. Do note the strings mentioned previously, that will help to fill some information in automagically.
A sample of what you may want in the template:
; Script for Program_name
SplashTextOn('', "Program_name", 400, 25, -1, -1, 1, '', 14)
Runwait("filename.ext /silentmode")
SplashOff()
This is your custom template for Inno Setup. When it would be read by Identify Installer, and the known strings are replaced, then the output script would look like:
; Script for NOD32 v2.50.25
SplashTextOn('', "NOD32 v2.50.25", 400, 25, -1, -1, 1, '', 14)
Runwait("NOD32 v2.50.25.exe /silentmode")
SplashOff()
Now, quick and easily, the output script is created to suit your needs.
When customizing, you may want to backup the original templates, in case you want use some information from them? You should definately
backup your customized templates, to prevent tragic loss.
End of lessen
If you are like me, and get tired of all the extra comments that display the workings in the script alot, then you may use this script.
If MsgBox(4, 'Comment remover', 'Remove comments, are you sure?') = 7 Then Exit
$read_handle = FileOpen($cmdline[1], 0)
$write_handle = FileOpen($cmdline[1] & '.temp', 2)
If $cmdline[0] = 1 Then
_SafeRemoval()
ElseIf $cmdline[0] = 2 Then
_FullRemoval()
EndIf
FileClose($read_handle)
FileClose($write_handle)
Sleep(100)
If FileRecycle($cmdline[1]) Then FileMove($cmdline[1] & '.temp', $cmdline[1])
Func _SafeRemoval()
While 1
$line = FileReadLine($read_handle)
If @error Then ExitLoop
$check = StringStripWS($line, 3)
If Not (StringLeft($check, 2) = ';~') And _
Not (StringRight($check, 1) = '.') And _
StringLeft($check, 1) = ';' Then ContinueLoop
FileWriteLine($write_handle, $line)
WEnd
EndFunc
Func _FullRemoval()
While 1
$line = FileReadLine($read_handle)
If @error Then ExitLoop
$check = StringStripWS($line, 3)
If StringLeft($check, 1) = ';' Then ContinueLoop
FileWriteLine($write_handle, $line)
WEnd
EndFunc
Compile it. If you drag'n'drop a script onto this, it will remove comments that do not end with a period (
.). You can also add it into your editor to pass the script path to the compiled exe. Or you can pass the script path by commandline to the compiled exe.
If you pass a 2nd switch to it also, which can be anything, it will remove all comments. Not recommended, as when you come back to look at the script latter, you will need to re-interpret what the script code is accomplishing throughout.
The original script is put into the recyle bin, and the replaced by the comment removed version.
I have it setup in the Scite directory, and have added to the user options file:
# 17 Comment Remover
command.17.$(file.patterns.au3)=comment_remover.exe "$(FilePath)"
command.name.17.$(file.patterns.au3)=Comment Remover
command.subsystem.17.$(file.patterns.au3)=1
command.save.before.17.$(file.patterns.au3)=1
command.is.filter.17.$(file.patterns.au3)=1
This will appear in the tools dropdown menu as Comment Remover, and will remove the comments without ending in a period, from the script displayed in the editor.
End of Comment Remover
Good luck.