Färben von Variablen...

Hallo Zusammen,

eventuell kann mir jemand weiterhelfen.

Habe eine Variable die folgende drei Werte enthalten kann:

[ul]
[li]0 - Pumpe aus
[/li][li]1 - Pumpe ein (Manuell)
[/li][li]100 - Pumpe ein (Automatik)
[/li][/ul]

Diese Variable möchte ich nun färbig darstellen.
Doch wie fange ich das jetzt am besten an?
Ist das nur in PHP möglich? (…Color & Font.Color?)

Wenn ja, hat jemand ein Beispielscript für mich?

Besten dank & LG! =)

Leo

z.B. über eine HTMLBox mit Html-Code. Scripts dafür gibt es im Forum.

Erstmals besten dank RWN!

Habe dein Script kopiert, und angelegt!
Eine Variable von Type String erstellt,
und die Var-ID, sowie das Profil im Script eingetragen.

Habe ich da jetzt nochwas vergessen? Kann das sein?

Habe ich da jetzt nochwas vergessen? Kann das sein?

Kann schon sein, nur woher soll ich das wissen. :confused: Zumal Du das eh an deine Bedürfnisse anpassen musst. Sollte eher als Beispiel herhalten.

Ja, nur damit ich es auch verstehe habe ich es erstmals versucht nachzubauen, und befülle die Variable von Hand.

…bzw. wo kann ich eigentlich eine HTMLBox erstellen?

String-Variable => Profil „HTML-Box“. :slight_smile:

Oh, besten Dank! =)

Mittlerweile habe ich von RWN ein tolles Script gefunden dass ich am laufen habe.

<?
$object = IPS_GetObject($IPS_SELF);
$parentID = $object['ParentID'];

CreateVariableByName($parentID, "Zustand", 3, "Window", "~HTMLBox", 1);

$state = GetValue(IPS_GetVariableIDByName("STATE", $parentID));
$status = IPS_GetVariableIDByName("Zustand", $parentID);

switch($state)
{
    case 0:
    //IPS_SetIcon($status, "Fenster1_32");
    SetValue($status, "<table width='100%'><tr bgcolor=#004000><td align='center'>Geschlossen</td></tr></table>");
    //WFC_Reload(43661 /*[WebFront Configurator]*/);
    break;

    case 1:
    //IPS_SetIcon($status, "Fenster1 Gekippt_32");
    SetValue($status, "<table width='100%'><tr bgcolor=#c08800><td align='center'>Gekippt</td></tr></table>");
    //WFC_Reload(43661 /*[WebFront Configurator]*/);
    break;

    case 2:
    //IPS_SetIcon($status, "Fenster1 Offen_32");
   SetValue($status, "<table width='100%'><tr bgcolor=#800000><td align='center'>Offen</td></tr></table>");
   //WFC_Reload(43661 /*[WebFront Configurator]*/);
   break;
}

function CreateVariableByName($id, $name, $type, $icon, $profil, $pos)
{
  global $IPS_SELF;
  $vid = @IPS_GetVariableIDByName($name, $id);
  if($vid === false)
  {
      $vid = IPS_CreateVariable($type);
      IPS_SetParent($vid, $id);
      IPS_SetName($vid, $name);
      IPS_SetPosition($vid, $pos);
        IPS_SetIcon($vid, $icon);
        IPS_SetVariableCustomProfile($vid, $profil);
      IPS_SetInfo($vid, "this variable was created by script #$IPS_SELF");
  }
  return $vid;
}
?> 

Besten Dank! =)