<?xml version="1.0" encoding="UTF-8"?>
<SapSetup Context="Variables" Version="4009">
	<Variable Name="Pre_SapGui71" Persistent="FALSE">
		<Value>FULFILLED</Value>
		<Value Script="TRUE"><![CDATA[
bFulFilled = vbTrue
			NwEngine.Context.Log.Write "Variable-Script-Action: Checking for older SAP GUI Versions..."
			If NwEngine.Shell.RegKeyExist("HKLM\SOFTWARE\SAP\SAP Shared") Then
				szRegValue = NwEngine.Shell.GetRegValue("HKLM\SOFTWARE\SAP\SAP Shared\SAPdestdir")
				NwEngine.Context.Log.Write "Variable-Script-Action: SapDestDir = " & szRegValue
				szSapGuiExe = szRegValue & "\SapGui\sapgui.exe"
				If NwEngine.Shell.FileExist( szSapGuiExe ) Then
					szVersion = NwEngine.Shell.GetFileVersion( szSapGuiExe )
					NwEngine.Context.Log.Write "Variable-Script-Action: Existing SAP GUI File-Version is " & szVersion
					szRelease = Mid( szVersion, 1, Instr( szVersion, "." ) - 1 )
					NwEngine.Context.Log.Write "Variable-Script-Action: Existing SAP GUI Release is " & szRelease
					If Int( szRelease ) < 7100 Then
						NwEngine.Context.Log.Write "Variable-Script-Action: This older version of SAP GUI needs to be uninstalled first."
						bFulFilled = vbFalse
					End If 
				End If
			End If
			If Not bFulFilled Then
				NwEngine.Variables.AppendDefaultValue "Pre_SapGui71", "UNDEFINED"
			End If
		]]></Value>
	</Variable>
	<Variable ConnectedId="{1460620D-C8BC-44c2-86EC-E632E0986B01}" Description="DscrSapFrontEndDir" DisplayInSapAdmin="TRUE" Name="SapFrontEndDir">
		<Value>%ProgramFiles%\SAP\FrontEnd</Value>
	</Variable>
	<Variable ConnectedId="{1460620D-C8BC-44c2-86EC-E632E0986B01}" Description="DscrSapWorkDir" DisplayInSapAdmin="TRUE" Name="SetSapWorkDir">
		<Value>SAP GUI Default</Value>
	</Variable>
	<Variable ConnectedId="{1460620D-C8BC-44c2-86EC-E632E0986B01}" Description="DscrSapGuiHistoryDir" DisplayInSapAdmin="TRUE" Name="SetSapGuiHistoryDir">
		<Value>SAP GUI Default</Value>
	</Variable>
	<Variable Name="Pre_CalSync" Persistent="FALSE">
		<Value>UNDEFINED</Value>
		<Value Script="TRUE"><![CDATA[
bFulFilled = vbTrue
		NwEngine.Context.Log.Write "Variable-Script-Action: Checking for MS Office Versions..."
		szMsOfficeDir = ""
		szMsOfficeVersion = ""
		If NwEngine.Shell.RegKeyExist("HKLM\SOFTWARE\Microsoft\Office\14.0\Outlook\InstallRoot") Then
			szMsOfficeDir = NwEngine.Shell.GetRegValue ("HKLM\SOFTWARE\Microsoft\Office\14.0\Outlook\InstallRoot\Path")
			If szMsOfficeDir <> "" Then
				szMsOfficeVersion = 14
			End If
		ElseIf NwEngine.Shell.RegKeyExist("HKLM\SOFTWARE\Microsoft\Office\12.0\Outlook\InstallRoot") Then
			szMsOfficeDir = NwEngine.Shell.GetRegValue ("HKLM\SOFTWARE\Microsoft\Office\12.0\Outlook\InstallRoot\Path")
			If szMsOfficeDir <> "" Then
				szMsOfficeVersion = 12
			End If				
		ElseIf NwEngine.Shell.RegKeyExist("HKLM\SOFTWARE\Microsoft\Office\11.0\Outlook\InstallRoot") Then
			szMsOfficeDir = NwEngine.Shell.GetRegValue ("HKLM\SOFTWARE\Microsoft\Office\11.0\Outlook\InstallRoot\Path")
			If szMsOfficeDir <> "" Then
				szMsOfficeVersion = 11
			End If				
		ElseIf NwEngine.Shell.RegKeyExist("HKLM\SOFTWARE\Microsoft\Office\10.0\Outlook\InstallRoot") Then
			szMsOfficeDir = NwEngine.Shell.GetRegValue ("HKLM\SOFTWARE\Microsoft\Office\10.0\Outlook\InstallRoot\Path")
			If szMsOfficeDir <> "" Then
				szMsOfficeVersion = 10
			End If				
		ElseIf NwEngine.Shell.RegKeyExist("HKLM\SOFTWARE\Microsoft\Office\9.0\Outlook\InstallRoot") Then
			szMsOfficeDir = NwEngine.Shell.GetRegValue ("HKLM\SOFTWARE\Microsoft\Office\9.0\Outlook\InstallRoot\Path")
			If szMsOfficeDir <> "" Then
				szMsOfficeVersion = 9
			End If				
		Else
			If NwEngine.Shell.RegKeyExist("HKLM\SOFTWARE\Microsoft\Office\8.0") Then
				szMsOfficeDir = NwEngine.Shell.GetRegValue ("HKLM\SOFTWARE\Microsoft\Office\8.0\BinDirPath")
				If szMsOfficeDir <> "" Then
					szMsOfficeVersion = 8
				End If					
			End If
		End If
		NwEngine.Context.Log.Write "Script: szMsOfficeDir = " & szMsOfficeDir
		NwEngine.Context.Log.Write "Script: szMsOfficeVersion = " & szMsOfficeVersion
		If szMsOfficeVersion <> "" Then
			intMsOfficeVersion = CInt(szMsOfficeVersion)
			If intMsOfficeVersion > 12 Then
				NwEngine.Context.Log.Write "Variable-Script-Action: Installation prerequisites for Calendar Synchronisation for Microsoft Outlook not fulfilled."
				bFulFilled = vbFalse
			End If
		Else
			NwEngine.Context.Log.Write "Variable-Script-Action: Installation prerequisites for Calendar Synchronisation for Microsoft Outlook not fulfilled."
			bFulFilled = vbFalse
		End If
		If bFulFilled Then
			NwEngine.Context.Log.Write "Variable-Script-Action: Installation prerequisites for Calendar Synchronisation for Microsoft Outlook are fulfilled."
			NwEngine.Variables.AppendDefaultValue "Pre_CalSync", "FULFILLED"
		End If
		]]></Value>
	</Variable>
</SapSetup>
