Suivez et participez au développement du nouvel OpenCellar : PLOC.co
Home Page
 
Français  English  
Open Cellar Home Edition - 1.2 - Windows 98, Me, 2000, XP and Vista. The free Windows wine cellar management software. Open Cellar Mobile Edition - Beta 2 (French version) - Pocket PC. The free Pocket PC wine cellar management software. Open Cellar Cross Platform - Beta 1 (French version) - Mac OSX and Linux. The free MacOS/Linux wine cellar management software. My Open Cellar Open Cellar Forums Place des vins
Search: Welcome (connect - create an account )
Page settings

Nuage de tags
Tous les vins à 75 cl
Le script suivant affecte à tous les vins le type de bouteille 75 cl
Pour l'éxécuter allez dans le menu "Préférences" -> "Editeurs de scripts"

if(App.ActiveCellar == null)
{
   MessageBox.Show("Aucune cave n'est ouverte");
   return;
}

string bottleName = "75 cl";


ObjectCollection bottles = App.ActiveCellar.GetCollection((ushort)ObjectType.BottleType);

BaseItem ret = null;

for (int i = 0; i < bottles.Count; i++)
{
	BaseItem item = (BaseItem)bottles[i];
	if(item.Name.Trim() == bottleName)	
	{
		ret = item;
		break;
	}
	
}


if(ret == null)
{
   MessageBox.Show("Bouteille \"" + bottleName + "\" introuvable.\nImpossible de continuer.");
   return;
}

ObjectCollection wines = App.ActiveCellar.GetCollection((ushort)ObjectType.Wine);

for (int i = 0; i < wines.Count; i++)
{
	Wine wine = (Wine)wines[i];
	if(wine.BottleType.Name.Trim() == String.Empty)
	{
		wine.BottleType = (BottleType)ret;
		wine.Save();
	}
}

 

© 2006-2014 Matthieu DUCROCQ  Open Cellar official blog - All rights reserved - Last update: january 2014 | twitter