#Region __ScriptInit
Local Const $__sDefScriptPattern = '/(?i)scriptname="([^"]+)'
; ---
Local $__sCurScriptTmp = StringRegExpReplace( $CmdLineRaw, '^.*' & $__sDefScriptPattern & '.*$', '\1' ), $__fCurScriptErr = ( @Extended = 0 )
If $__fCurScriptErr Then _
$__sCurScriptTmp = "default"
Local Const $sCurScriptName = $__sCurScriptTmp
; -
Func __RunSelfScript( $sName = "default" )
Local $sRunLine = $CmdLineRaw, $sCmdScriptName = '/scriptname="' & $sName & '"'
; ---
If $__fCurScriptErr Then
$sRunLine &= ' /scriptname="' & $sName & '"'
Else
$sRunLine = StringRegExpReplace( $sRunLine, $__sDefScriptPattern, $sCmdScriptName )
EndIf
Return Run( @ScriptFullPath & ' ' & $sRunLine, @ScriptDir )
EndFunc
#EndRegion __ScriptInit
If $sCurScriptName = "default" Then ;Скрипт по умолчанию
__RunSelfScript( "script_2" )
; ---
MsgBox( 64, "", "Script 2 now started!" )
ElseIf $sCurScriptName = "script_2" Then
MsgBox( 64, "", "I am second script..." )
Else
MsgBox( 16, "Error", "Script not found!" )
EndIf