
Set $IniFile32$ = $InstallDir32$ + "\opsi-" + $ProductId$ + ".ini"

Set $IniFile64$ = $InstallDir64$ + "\opsi-" + $ProductId$ + ".ini"

if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
        if FileExists($IniFile32$)
		Set $OnceUninstallDone$ = GetValueFromInifile($IniFile32$,"COMMON","OnceUninstallDone","false")
        endif
endif

if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
        if FileExists($IniFile64$)
		Set $OnceUninstallDone$ = GetValueFromInifile($IniFile64$,"COMMON","OnceUninstallDone","false")
        endif
endif

DefVar	$MSVersion$
Set 	$MSVersion$ = GetMsVersionInfo


DefVar	$timer_value$
Set 	$timer_value$ = GetProductProperty("timer_value", "40")
DefVar	$timer_enabled$
Set	$timer_enabled$ = GetProductProperty("timer_enabled", "1")
DefVar	$dotnet1.1$
Set 	$dotnet1.1$ = GetProductProperty("dotnet1.1", "install")
DefVar 	$dotnet2.0$
Set 	$dotnet2.0$ = GetProductProperty("dotnet2.0", "install")
DefVar	$dotnet3.0$
Set 	$dotnet3.0$ = GetProductProperty("dotnet3.0", "install")
DefVar	$dotnet3.5$
Set 	$dotnet3.5$ = GetProductProperty("dotnet3.5", "install")
DefVar	$dotnet4.0$
Set 	$dotnet4.0$ = GetProductProperty("dotnet4.0", "install")
DefVar	$dotnet4.5$
Set 	$dotnet4.5$ = GetProductProperty("dotnet4.5", "install")
DefVar	$msjsharp$
Set 	$msjsharp$ = GetProductProperty("msjsharp", "install")
DefVar	$silver$
Set 	$silver$ = GetProductProperty("silver", "install")
DefVar	$jre7$
Set 	$jre7$ = GetProductProperty("jre7", "install")
DefVar	$AdobeShock$
Set 	$AdobeShock$ = GetProductProperty("AdobeShock", "install")
DefVar	$basicruntimes$
Set 	$basicruntimes$ = GetProductProperty("basicruntimes", "install")
DefVar	$msdx9$
Set 	$msdx9$ = GetProductProperty("msdx9", "install")
DefVar	$msdxm$
Set 	$msdxm$ = GetProductProperty("msdxm", "install")
DefVar	$msvc$
Set 	$msvc$ = GetProductProperty("msvc", "install")
DefVar	$AdobeFlash$
Set 	$AdobeFlash$ = GetProductProperty("AdobeFlash", "install")



DefVar	$once_dotnet1.1$
Set 	$once_dotnet1.1$ = GetProductProperty("once_dotnet1.1", "uninstall")
DefVar 	$once_dotnet2.0$
Set 	$once_dotnet2.0$ = GetProductProperty("once_dotnet2.0", "uninstall")
DefVar	$once_dotnet3.0$
Set 	$once_dotnet3.0$ = GetProductProperty("once_dotnet3.0", "uninstall")
DefVar	$once_dotnet3.5$
Set 	$once_dotnet3.5$ = GetProductProperty("once_dotnet3.5", "nninstall")
DefVar	$once_dotnet4.0$
Set 	$once_dotnet4.0$ = GetProductProperty("once_dotnet4.0", "uninstall")
DefVar	$once_dotnet4.5$
Set 	$once_dotnet4.5$ = GetProductProperty("once_dotnet4.5", "uninstall")
DefVar	$once_msjsharp$
Set 	$once_msjsharp$ = GetProductProperty("once_msjsharp", "uninstall")
DefVar	$once_silver$
Set 	$once_silver$ = GetProductProperty("once_silver", "uninstall")
DefVar	$once_jre7$
Set 	$once_jre7$ = GetProductProperty("once_jre7", "uninstall")
DefVar	$once_AdobeShock$
Set 	$once_AdobeShock$ = GetProductProperty("once_AdobeShock", "uninstall")
DefVar	$once_basicruntimes$
Set 	$once_basicruntimes$ = GetProductProperty("once_basicruntimes", "uninstall")
DefVar	$once_msdx9$
Set 	$once_msdx9$ = GetProductProperty("once_msdx9", "uninstall")
DefVar	$once_msdxm$
Set 	$once_msdxm$ = GetProductProperty("once_msdxm", "uninstall")
DefVar	$once_msvc$
Set 	$once_msvc$ = GetProductProperty("once_msvc", "uninstall")
DefVar	$once_AdobeFlash$
Set 	$once_AdobeFlash$ = GetProductProperty("once_AdobeFlash", "uninstall")



if getValue("lastactionrequest", getProductMap) = "once"
    if ($OnceUninstallDone$ = "false")
        if ($once_dotnet1.1$ = "uninstall")
	    Winbatch_dotnet1.1_uninstall
        endif
        if ($once_dotnet2.0$ = "uninstall")
	    Winbatch_dotnet2.0_uninstall
        endif
        if ($once_dotnet3.0$ = "uninstall")
	    Winbatch_dotnet3.0_uninstall
        endif
        if ($once_dotnet3.5$ = "uninstall")
            Winbatch_dotnet3.5_uninstall
        endif
        if ($once_dotnet4.0$ = "uninstall")
            Winbatch_dotnet4.0_uninstall
        endif
        if ($once_dotnet4.5$ = "uninstall")
            Winbatch_dotnet4.5_uninstall
        endif
        if ($once_msjsharp$ = "uninstall")
            Winbatch_msjsharp_uninstall
        endif
        if ($once_silver$ = "uninstall")
            Winbatch_silver_uninstall
        endif
        if ($once_jre7$ = "uninstall")
            Winbatch_jre7_uninstall
        endif
        if ($once_AdobeShock$ = "uninstall")
            Winbatch_AdobeShock_uninstall
        endif
        if ($once_basicruntimes$ = "uninstall")
            Winbatch_basicruntimes_uninstall
        endif
        if ($once_msdx9$ = "uninstall")
            Winbatch_msdx9_uninstall
        endif
        if ($once_msdxm$ = "uninstall")
            Winbatch_msdxm_uninstall
        endif
        if ($once_msvc$ = "uninstall")
            Winbatch_msvc_uninstall
        endif
        if ($once_AdobeFlash$ = "uninstall")
            Winbatch_AdobeFlash_uninstall
        endif
        if FileExists($IniFile32$)
    		inifile $IniFile32$ [COMMON] OnceUninstallDone=true
        endif
        if FileExists($IniFile64$)
    		inifile $IniFile64$ [COMMON] OnceUninstallDone=true
        endif
        comment "uninstall done now force Reboot"
        ExitWindows /ImmediateReboot
    endif
endif


Winbatch_init_config

if ($dotnet1.1$ = "install")
    Winbatch_dotnet1.1_config
endif
if ($dotnet2.0$ = "install")
    Winbatch_dotnet2.0_config
endif
if ($dotnet3.0$ = "install")
    Winbatch_dotnet3.0_config
endif
if ($dotnet3.5$ = "install")
    Winbatch_dotnet3.5_config
endif
if ($dotnet4.0$ = "install")
    Winbatch_dotnet4.0_config
endif
if ($dotnet4.5$ = "install")
    Winbatch_dotnet4.5_config
endif
if ($msjsharp$ = "install")
    Winbatch_msjsharp_config
endif
if ($silver$ = "install")
    Winbatch_silver_config
endif
if ($jre7$ = "install")
    Winbatch_jre7_config
endif
if ($AdobeShock$ = "install")
    Winbatch_AdobeShock_config
endif
if ($basicruntimes$ = "install")
    Winbatch_basicruntimes_config
endif
if ($msdx9$ = "install")
    Winbatch_msdx9_config
endif
if ($msdxm$ = "install")
    Winbatch_msdxm_config
endif
if ($msvc$ = "install")
    Winbatch_msvc_config
endif
if ($AdobeFlash$ = "install")
    Winbatch_AdobeFlash_config
endif

Winbatch_finish_config


[Winbatch_init_config]
copy "%ScriptPath%\Config\WinPKG.xml" "$LogDir$"

copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/timer[@value=40]/@value" -v $timer_value$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/timer[@enabled=0]/@enabled" -v $timer_enabled$ "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_dotnet1.1_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='net1.1']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_dotnet2.0_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='net2.0']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_dotnet3.0_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='net3.0']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_dotnet3.5_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='net3.5']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_dotnet4.0_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='net4.0']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_dotnet4.5_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='net4.5']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_msjsharp_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='msjsharp']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_silver_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='silver']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_jre7_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='jre7']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_AdobeShock_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='AdobeShock']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_basicruntimes_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='basicruntimes']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_msdx9_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='msdx9']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_msdxm_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='msdxm']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_msvc_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='msvc']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_AdobeFlash_config]
copy "$LogDir$\WinPKG.xml" "$LogDir$\WinPKG.xml.old"
xml ed -O -u "/settings/set[@component='AdobeFlash']/@checked" -v 1 "$LogDir$\WinPKG.xml.old" > "$LogDir$\WinPKG.xml"

[Winbatch_finish_config]
move $LogDir$\WinPKG.xml "%System%"
del $LogDir$\WinPKG.xml.old



[Winbatch_dotnet1.1_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 1.1 /u"

[Winbatch_dotnet2.0_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 2.0 /u"

[Winbatch_dotnet3.0_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 3.0 /u"

[Winbatch_dotnet3.5_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 3.5 /u"

[Winbatch_dotnet4.0_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 4.0 /u"

[Winbatch_dotnet4.5_uninstall]
%ScriptPath%\UnInstall\NET\cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 4.5 /u"

[Winbatch_msjsharp_uninstall]

[Winbatch_silver_uninstall]

[Winbatch_jre7_uninstall]
; copy "%ScriptPath%\UnInstall\Package\JRE\JavaRa.*" "$LogDir$\"
; $LogDir$\JavaRa.exe /REMOVEOLD /SILENT /UPDATEDEFS
cscript /nologo "%ScriptPath%\UnInstall\Package\JRE\JavaUninstallScript.vbs" /keeponly

[Winbatch_AdobeShock_uninstall]

[Winbatch_basicruntimes_uninstall]

[Winbatch_msdx9_uninstall]

[Winbatch_msdxm_uninstall]

[Winbatch_msvc_uninstall]

[Winbatch_AdobeFlash_uninstall]

