if then else mess...

I’m sure I’ve got this pretty well confused after looking at it for a while. Where am I messing it up?

tell application "Finder"
	activate
	display dialog ("Install LanSchool for:") with title ("WCC LanSchool Install") buttons {"Student", "Teacher", "Cancel"} default button 1
	set installType to button returned of result
	get installType
	
	set compName to do shell script "scutil --get HostName" --host name of (system info)
	get compName

	set alert1 to "Confirm"
	set alert2 to "Install LanSchool '" & installType & "' on computer " & "'" & compName & "' ?"

	try
	display alert alert1 message alert2 buttons {"Install", "Cancel"} default button 1
	if button returned = "Install" then
		if installType = "Student" then
			if compName contains "A118" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-1218-Student.pkg -target LocalSystem"
				end if
			else
			if compName contains "BDE205" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-4205-Student.pkg -target LocalSystem"
				end if
			else
			if compName contains "HCC107" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-9107-Student.pkg -target LocalSystem"
				end if
			else
			if compName contains "HCC110" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-9110-Student.pkg -target LocalSystem"
				end if
			else
			if compName contains "DKN107" then
				beep
				end if
			end if
		else
		if installType = "Teacher" then
			if compName contains "BDE205" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-4205-Teacher.pkg -target LocalSystem"
				end if
			else
			if compName contains "HCC107" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-9107-Teacher.pkg -target LocalSystem"
				end if
			else
			if compName contains "DKN107" then
				beep 2
				end if
		end if
	end if
	end try
end tell
tell application "Finder"
	activate
	display dialog ("Install LanSchool for:") with title ("WCC LanSchool Install") buttons {"Student", "Teacher", "Cancel"} default button 1
end tell
set installType to button returned of result

set compName to do shell script "scutil --get HostName" --host name of (system info)

set alert1 to "Confirm"
set alert2 to "Install LanSchool '" & installType & "' on computer " & "'" & compName & "' ?"

try
	tell application "Finder" to display alert alert1 message alert2 buttons {"Install", "Cancel"} default button 1
	if button returned = "Install" then
		if installType = "Student" then
			if compName contains "A118" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-1218-Student.pkg -target LocalSystem"
			else if compName contains "BDE205" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-4205-Student.pkg -target LocalSystem"
			else if compName contains "HCC107" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-9107-Student.pkg -target LocalSystem"
			else if compName contains "HCC110" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-9110-Student.pkg -target LocalSystem"
			else if compName contains "DKN107" then
				beep
			end if
		else if installType = "Teacher" then
			if compName contains "BDE205" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-4205-Teacher.pkg -target LocalSystem"
			else if compName contains "HCC107" then
				do shell script "installer -pkg /Library/WCC-Install/LanSchool78-9107-Teacher.pkg -target LocalSystem"
			else if compName contains "DKN107" then
				beep 2
			end if
		end if
	end if
end try

you probably mean this


tell application "Finder"
	activate
	display dialog ("Install LanSchool for:") with title ("WCC LanSchool Install") buttons {"Student", "Teacher", "Cancel"} default button 1
	set installType to button returned of result
	
	set compName to do shell script "scutil --get HostName" --host name of (system info)
	
	set alert1 to "Confirm"
	set alert2 to "Install LanSchool '" & installType & "' on computer " & "'" & compName & "' ?"
	
	try
		display alert alert1 message alert2 buttons {"Install", "Cancel"} default button 1
		if button returned of result = "Install" then
			if installType = "Student" then
				if compName contains "A118" then
					do shell script "installer -pkg /Library/WCC-Install/LanSchool78-1218-Student.pkg -target LocalSystem"
				else if compName contains "BDE205" then
					do shell script "installer -pkg /Library/WCC-Install/LanSchool78-4205-Student.pkg -target LocalSystem"
				else if compName contains "HCC107" then
					do shell script "installer -pkg /Library/WCC-Install/LanSchool78-9107-Student.pkg -target LocalSystem"
				else if compName contains "HCC110" then
					do shell script "installer -pkg /Library/WCC-Install/LanSchool78-9110-Student.pkg -target LocalSystem"
				else if compName contains "DKN107" then
					beep
				end if
			else if installType = "Teacher" then
				if compName contains "BDE205" then
					do shell script "installer -pkg /Library/WCC-Install/LanSchool78-4205-Teacher.pkg -target LocalSystem"
				else if compName contains "HCC107" then
					do shell script "installer -pkg /Library/WCC-Install/LanSchool78-9107-Teacher.pkg -target LocalSystem"
				else if compName contains "DKN107" then
					beep 2
				end if
			end if
		end if
	end try
end tell

-- scutil isn't always set properly, use system info instead
set compName to host name of (system info)

tell application "Finder"
	activate
	set installType to button returned of (display dialog ("Install LanSchool for:") with title ("WCC LanSchool Install") buttons {"Student", "Teacher", "Cancel"} default button 1)
end tell

-- In case the system's language is not English
if installType = "Cancel" then error number -128

set msg to "Install LanSchool '" & installType & "' on computer " & "'" & compName & "' ?"
tell application "Finder"
	activate
	set confirmed to button returned of (display alert "Confirm" message msg buttons {"Install", "Cancel"} default button 1) = "Install"
end tell

set theScript to false
if confirmed then
	set theScript to "installer -pkg "
	if installType = "Student" then
		if compName contains "A118" then
			set theScript to theScript & "/Library/WCC-Install/LanSchool78-1218-Student.pkg -target LocalSystem"
		else if compName contains "BDE205" then
			set theScript to theScript & "/Library/WCC-Install/LanSchool78-4205-Student.pkg -target LocalSystem"
		else if compName contains "HCC107" then
			set theScript to theScript & "/Library/WCC-Install/LanSchool78-9107-Student.pkg -target LocalSystem"
		else if compName contains "HCC110" then
			set theScript to theScript & " /Library/WCC-Install/LanSchool78-9110-Student.pkg -target LocalSystem"
		else if compName contains "DKN107" then
			beep
			set theScript to false
		else -- if the host name is not known
			error "Unknown hostname" number 1
		end if
	else
		if installType = "Teacher" then
			if compName contains "BDE205" then
				set theScript to theScript & "/Library/WCC-Install/LanSchool78-4205-Teacher.pkg -target LocalSystem"
			else if compName contains "HCC107" then
				set theScript to theScript & "/Library/WCC-Install/LanSchool78-9107-Teacher.pkg -target LocalSystem"
			else if compName contains "DKN107" then
				beep 2
				set theScript to false
			else -- if the host name is not known
				error "Unknown hostname" number 1
			end if
		end if
	end if
end if

if theScript is not false then do shell script theScript

edit: Scripts above are good too, I didn’t saw them when I wrote my post

Outstanding… Thanks everybody! I ended up with something based on the basics put forth in all these suggestions. I also found that I can make the installer run with admin privileges, which is necessary.

Thanks again for such quick and thorough responses. Gentlemen and scholars all. ;^)