Example:
[Read_ENV2] If,NOT,"%ProjectTitle%",Equal,"Leopard",Begin If,Not,#1,Equal,,Begin If,#2,Equal,,IniRead,%ProjectInfo%,"%OsType%Info",#1,%#1% Else,IniRead,%ProjectInfo%,"%OsType%Info",#1,%#2% End Else,Begin IniRead,%ProjectInfo%,%OsType%Info,SourceType,%SourceType% If,%SourceType%,Equal,,Run,%API%,NotConfigured IniRead,%ProjectInfo%,%OsType%Info,Language,%DistLang% IniRead,%ProjectInfo%,%OsType%Info,SourceDir,%SDIR% IniRead,%ProjectInfo%,%OsType%Info,WimTools,%WimTools% IniRead,%ProjectInfo%,%OsType%Info,SystemFiles,%SystemFiles% If,%WimTools%,Equal,ImageX,IniRead,%ProjectInfo%,%OsType%Info,imagex,%IMAGEX% IniRead,%ProjectInfo%,%OsType%Info,BuildModel,%BuildModel% IniRead,%ProjectInfo%,%OsType%Info,Shell,%Shell% IniRead,%ProjectInfo%,%OsType%Info,ScreenResolution,%ScreenResolution% IniRead,%ProjectInfo%,%OsType%Info,Locale,%Locale% IniRead,%ProjectInfo%,%OsType%Info,SysType,%SysType% IniRead,%ProjectInfo%,%OsType%Info,GrubSkin,%GrubSkin% IniRead,%ProjectInfo%,%OsType%Info,ForceAllToRam,%ForceAllToRam% IniRead,%ProjectInfo%,%OsType%Info,Drivers,%Drivers% IniRead,%ProjectInfo%,%OsType%Info,IsoLinuxMode,%IsoLinuxMode% IniRead,%ProjectInfo%,%OsType%Info,DllSrc,%DllSrc% IniRead,%ProjectInfo%,%OsType%Info,WAIKDir,%WAIKDir% IniRead,%ProjectInfo%,%OsType%Info,BootManager,%BootManager% IniRead,%ProjectInfo%,%OsType%Info,Type,%Type% End EndHere in most cases only one variable is queried, and the large Begin ... End block is not processed.
Unfortunatelly "not processed" is wrong.
Every command line following "Begin" is read and parsed for an "End" command.
But if another Begin ... End block is contained in the first block, processing would be started again at the end of the nested block
Therefore "If" commands have to be examinated for a Begin, and a nest-level count has to be done.
My suggestion: Replace the big block by a single "Run" command, where all the block's lines are executed.
[Read_ENV2] If,NOT,"%ProjectTitle%",Equal,"Leopard",Begin If,Not,#1,Equal,,Begin If,#2,Equal,,IniRead,%ProjectInfo%,"%OsType%Info",#1,%#1% Else,IniRead,%ProjectInfo%,"%OsType%Info",#1,%#2% End Else,Run,%ScriptFile%,Read_Env2A End [Read_Env2A] IniRead,%ProjectInfo%,%OsType%Info,SourceType,%SourceType% If,%SourceType%,Equal,,Run,%API%,NotConfigured IniRead,%ProjectInfo%,%OsType%Info,Language,%DistLang% IniRead,%ProjectInfo%,%OsType%Info,SourceDir,%SDIR% IniRead,%ProjectInfo%,%OsType%Info,WimTools,%WimTools% IniRead,%ProjectInfo%,%OsType%Info,SystemFiles,%SystemFiles% If,%WimTools%,Equal,ImageX,IniRead,%ProjectInfo%,%OsType%Info,imagex,%IMAGEX% IniRead,%ProjectInfo%,%OsType%Info,BuildModel,%BuildModel% IniRead,%ProjectInfo%,%OsType%Info,Shell,%Shell% IniRead,%ProjectInfo%,%OsType%Info,ScreenResolution,%ScreenResolution% IniRead,%ProjectInfo%,%OsType%Info,Locale,%Locale% IniRead,%ProjectInfo%,%OsType%Info,SysType,%SysType% IniRead,%ProjectInfo%,%OsType%Info,GrubSkin,%GrubSkin% IniRead,%ProjectInfo%,%OsType%Info,ForceAllToRam,%ForceAllToRam% IniRead,%ProjectInfo%,%OsType%Info,Drivers,%Drivers% IniRead,%ProjectInfo%,%OsType%Info,IsoLinuxMode,%IsoLinuxMode% IniRead,%ProjectInfo%,%OsType%Info,DllSrc,%DllSrc% IniRead,%ProjectInfo%,%OsType%Info,WAIKDir,%WAIKDir% IniRead,%ProjectInfo%,%OsType%Info,BootManager,%BootManager% IniRead,%ProjectInfo%,%OsType%Info,Type,%Type%Compare of the generated log lines:
compared withRun - Processing section: [Read_ENV2] From file: [%BaseDir%\Projects\multiPE\Library\Common_apiEx.script]
[Parameter] with parameters: [SysLocale]
[Success] IF - [nativeex_multipe] is not equal to: [leopard] evaluated string: [If,NOT,"%ProjectTitle%",Equal,"Leopard",Begin]
[Success] IF - [syslocale] is not equal to: [] evaluated string: [If,Not,#1,Equal,,Begin]
[Success] IF - [] is equal to: [] evaluated string: [If,#2,Equal,,IniRead,%ProjectInfo%,"%OsType%Info",#1,%#1%]
[Success] IniRead - [%BaseDir%\Projects\multiPE\project.4.ini] Section [%OsType%Info] Key [SysLocale] to variable: [%SysLocale%] with value []
[Ignore] ELSE - [IniRead,%ProjectInfo%,%OsType%Info,#1,%#2%]
[Success] [End]
[Ignore] ELSE - [Begin]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,SourceType,%SourceType%]
[Skipped] [If,%SourceType%,Equal,,Run,%API%,NotConfigured]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,Language,%DistLang%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,SourceDir,%SDIR%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,WimTools,%WimTools%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,SystemFiles,%SystemFiles%]
[Skipped] [If,%WimTools%,Equal,ImageX,IniRead,%ProjectInfo%,%OsType%Info,imagex,%IMAGEX%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,BuildModel,%BuildModel%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,Shell,%Shell%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,ScreenResolution,%ScreenResolution%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,Locale,%Locale%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,SysType,%SysType%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,GrubSkin,%GrubSkin%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,ForceAllToRam,%ForceAllToRam%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,Drivers,%Drivers%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,IsoLinuxMode,%IsoLinuxMode%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,DllSrc,%DllSrc%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,WAIKDir,%WAIKDir%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,BootManager,%BootManager%]
[Skipped] [IniRead,%ProjectInfo%,%OsType%Info,Type,%Type%]
[Ignore] [End]
[Success] [End]
Run - Processed section [Read_ENV2] in file: [%BaseDir%\Projects\multiPE\Library\Common_apiEx.script]
I made a run time test with 1024 codebox lines "ReadEnv,SysLocale"Run - Processing section: [Read_ENV2] From file: [%BaseDir%\Projects\multiPE\Library\Common_apiEx.script]
[Parameter] with parameters: [SysLocale]
[Success] IF - [nativeex_multipe] is not equal to: [leopard] evaluated string: [If,NOT,"%ProjectTitle%",Equal,"Leopard",Begin]
[Success] IF - [syslocale] is not equal to: [] evaluated string: [If,Not,#1,Equal,,Begin]
[Success] IF - [] is equal to: [] evaluated string: [If,#2,Equal,,IniRead,%ProjectInfo%,"%OsType%Info",#1,%#1%]
[Success] IniRead - [%BaseDir%\Projects\multiPE\project.4.ini] Section [%OsType%Info] Key [SysLocale] to variable: [%SysLocale%] with value []
[Ignore] ELSE - [IniRead,%ProjectInfo%,%OsType%Info,#1,%#2%]
[Success] [End]
[Ignore] ELSE - [Run,%ScriptFile%,Read_Env2A]
[Success] [End]
Run - Processed section [Read_ENV2] in file: [%BaseDir%\Projects\multiPE\Library\Common_apiEx.script]
Result: actual ( C ) API: 1 min 45 sec
my proposed code: 23 sec
Peter