//////////////////////////////////////////////////////////////////////
// Filename:		UninstallOPK.OGS
// Purpose:		Labtalk for Uninstalling Origin Pack files
// Creation:		by Scott Bertrand, 12/10/2001
// Modifications:
//////////////////////////////////////////////////////////////////////

[OnOpen]
	run.section(,LoadDialog, 0);
	run.section(,LoadDialog, 2);
	if(dialog.status(OTools.dll,UninstallOPK)!=0)
		type -b $OPK.NoFiles;
	return 0;

[LoadDialog]
	opack.installed=%1;
	loop(ii,1,opack.installed#)
	{
		if(dialog.status(OTools.dll,UninstallOPK)!=0)
			dialog.start(OTools.dll,UninstallOPK);
		%A=opack.installed$(ii)$;
		if(%[%A]>0)
			UninstallOPK!Filelist.add(%A);
							
	}
	return 0;


[Uninstall.OnClick]
	loop(ii,1,UninstallOPK!Filelist.Numsels)
	{
		%A=UninstallOPK!Filelist.s$(ii)$;
		jj=opack.uninstall(%A,0);
		if(jj==10)
			jj=opack.uninstall(%A,2);
		switch(jj)
		{
			case 0:
				type -b	$OPK.UninstallSuccess;
				break;
			case 7:
				type -b	$OPK.FileLocked;
				break;
			case 8:
				type -b	$OPK.NoExist;
				break;
		}
		dialog.close(OTools.dll,UninstallOPK);
	}
	return 0;	
