Ich habe folgendes Poblem:
Bei einem Script siehe unten, erscheint jedesmal bei der Script Fehlerprüfung:
Code: Alles auswählen
Error 1 at row 147 col 24 near ^ == 0)
{
! alles zu
string zeile2 = "k
Parse following code failed:
!! Batterieanzeige
!! Taste2 lang
!!.
Könnte sich jemand das mal ansehen?
Danke
Code: Alles auswählen
!! Batterieanzeige
!! Taste2 lang
!!
!! Universalprogramm zum Füllen
!! (c) DrTob
!! optimized by thkl
!!
!! Anzeige der Stati aller Batterien
!! Alle Sensoren müssen im Gewerk "Batteriefehler" sein.
!! Das Script holt sich jetzt die Seriennummer des Displays selbst aus der Auslösebedingung des Programms
! Farben
string weiss = "0x80";
string rot = "0x81";
string orange = "0x82";
string gelb = "0x83";
string gruen = "0x84";
string blau = "0x85";
! Symbole
! 0x80 AUS
! 0x81 EIN
! 0x82 OFFEN
! 0x83 geschlossen
! 0x84 fehler
! 0x85 alles ok
! 0x86 information
! 0x87 neue nachricht
! 0x88 servicemeldung
! 0x89 Signal grün
! 0x8A Signal gelb
! 0x8B Signal rot
! =========================schipp==================
var myAssembly = dom.GetObject("Batteriefehler");
string itemID;
string text = "";
string stdout;
string stderr;
integer counter = 0;
! Auflistung Geräte nach Batterietyp
string cr2016 = "HM-RC-4\tHM-RC-4-B\tHM-RC-Sec3\tHM-RC-Sec3-B\tHM-RC-P1\tHM-RC-Key3\tHM-RC-Key3-B";
string cr2032 = "HM-PB-2-WM\tHM-SwI-3-FM\tHM-PBI-4-FM\tHM-Sec-TiS";
string lr44 = "HM-Sec-SC\tHM-Sec-RHS";
string lr6 = "HM-Sec-MDIR\tHM-CC-TC\tHM-CC-VD\tHM-WDS100-C6-O\tHM-WDS40-TH-I\tHM-WDS10-TH-O\tHM-WDS30-T-O\tHM-Sec-Key\tHM-Sec-SD\tHM-Sec-WDS";
string lr3 = "HM-RC-12\tHM-PB-4Dis-WM\tHM-Sen-EP";
string battyp;
string index;
! Durch alle angemeldeten Geräte laufen
foreach(itemID, myAssembly.EnumUsedIDs())
{
! Gerätedetails & Schnittstelle holen
var item = dom.GetObject(itemID);
var device = dom.GetObject(item.Device());
var interface = dom.GetObject(item.Interface());
! Name, Adresse und Kanal auslesen
string interface_name = interface.Name();
string device_address = device.Address();
device_address = device_address.StrValueByIndex(":", 0);
string channel_name = interface_name # "." # device_address # ":0.LOWBAT";
var channel = dom.GetObject(channel_name);
! Batterie leer?
if ( (channel.State() == true) && (channel.Value() == true) )
{
! Gerät enthält CR2016-Batterie?
! batlink = "unbekannt";
foreach (index, cr2016) {
!WriteLine(device.HssType());
if (index == device.HssType()) {
battyp = "CR2016 ";
}
}
! Gerät enthält CR2032-Batterie?
foreach (index, cr2032) {
if (index == device.HssType()) {
battyp = "CR2032 ";
}
}
! Gerät enthält LR44-Batterie?
foreach (index, lr44) {
if (index == device.HssType()) {
battyp = "LR44 ";
}
}
! Gerät enthält LR6-Batterie?
foreach (index, lr6) {
if (index == device.HssType()) {
battyp = "AA ";
}
}
! Gerät enthält LR3-Batterie?
foreach (index, lr3) {
if (index == device.HssType()) {
battyp = "AAA ";
}
}
! Text zusammensetzen
text = text # "- " # item.Name() # " vom Typ: " # battyp # "\r\n";
! Counter erhöhen (Anzahl leerer Batterien)
counter = counter + 1;
}
}
! Mind. eine leere Batterie gefunden?
if ( counter > 0 )
{
! setzen der Systemvariablen mit der Liste der Komponenten
dom.GetObject('V_LowBat').State(text);
}
! ===============Schapp===========
string zeile1 = "Batterien";
string color1 = weiss;
string icon1 = "";
string zeile2 = "";
string color2 = "";
string icon2 = "";
string zeile3 = "";
string color3 = "";
string icon3 = "";
string zeile4 = "";
string color4 = "";
string icon4 = "";
string zeile5 = "";
string color5 = "";
string icon5 = "";
string zeile6 = "";
string color6 = "";
string icon6 = "";
if ( status == 0)
{
! alles zu
string zeile2 = "keine leere";
string color2 = gruen;
string icon2 = "";
string zeile3 = "Batterie";
string color3 = gruen;
string icon3 = "";
string zeile4 = "";
string color4 = gruen;
string icon4 = "";
string zeile5 = " ";
string color5 = gruen;
string icon5 = "0x85";
string zeile6 = "";
string color6 = gruen;
string icon6 = "";
}
else
{
! irgendwo was ein
integer i = 2;
foreach (nam, listo.Split(","))
{
if ((zeil.Length() + nam.Length()) < 12)
{
if (zeil == "")
{
zeil = nam;
}
else
{
zeil = zeil # "," # nam;
}
}
else
{
if (i == 2)
{
string zeile2 = zeil;
string color2 = blau;
string icon2 = "";
}
if (i == 3)
{
string zeile3 = zeil;
string color3 = blau;
string icon3 = "";
}
if (i == 4)
{
string zeile4 = zeil;
string color4 = blau;
string icon4 = "";
}
if (i == 5)
{
string zeile5 = zeil;
string color5 = blau;
string icon5 = "";
}
if (i == 6)
{
string zeile6 = zeil;
string color6 = blau;
string icon6 = "";
}
zeil = nam;
i = i + 1;
}
}
if (zeil <> "")
{
if (i == 2)
{
string zeile2 = zeil;
string color2 = blau;
string icon2 = "";
}
if (i == 3)
{
string zeile3 = zeil;
string color3 = blau;
string icon3 = "";
}
if (i == 4)
{
string zeile4 = zeil;
string color4 = blau;
string icon4 = "";
}
if (i == 5)
{
string zeile5 = zeil;
string color5 = blau;
string icon5 = "";
}
if (i == 6)
{
string zeile6 = zeil;
string color6 = blau;
string icon6 = "";
}
zeil = "";
i = i + 1;
}
foreach (nam, listg.Split(","))
{
if ((zeil.Length() + nam.Length()) < 12)
{
if (zeil == "")
{
zeil = nam;
}
else
{
zeil = zeil # "," # nam;
}
}
else
{
if (i == 2)
{
string zeile2 = zeil;
string color2 = blau;
string icon2 = "";
}
if (i == 3)
{
string zeile3 = zeil;
string color3 = blau;
string icon3 = "";
}
if (i == 4)
{
string zeile4 = zeil;
string color4 = blau;
string icon4 = "";
}
if (i == 5)
{
string zeile5 = zeil;
string color5 = blau;
string icon5 = "";
}
if (i == 6)
{
string zeile6 = zeil;
string color6 = blau;
string icon6 = "";
}
zeil = nam;
i = i + 1;
}
}
if (zeil <> "")
{
if (i == 2)
{
string zeile2 = zeil;
string color2 = gelb;
string icon2 = "";
}
if (i == 3)
{
string zeile3 = zeil;
string color3 = gelb;
string icon3 = "";
}
if (i == 4)
{
string zeile4 = zeil;
string color4 = gelb;
string icon4 = "";
}
if (i == 5)
{
string zeile5 = zeil;
string color5 = gelb;
string icon5 = "";
}
if (i == 6)
{
string zeile6 = zeil;
string color6 = gelb;
string icon6 = "";
}
zeil = "";
i = i + 1;
}
}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! System Routine do not change anything below !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
string splitter="|";
string msgBuffer = zeile1 # splitter # color1 # splitter # icon1 # "\t";
msgBuffer = msgBuffer # zeile2 # splitter # color2 # splitter # icon2 # "\t";
msgBuffer = msgBuffer # zeile3 # splitter # color3 # splitter # icon3 # "\t";
msgBuffer = msgBuffer # zeile4 # splitter # color4 # splitter # icon4 # "\t";
msgBuffer = msgBuffer # zeile5 # splitter # color5 # splitter # icon5 # "\t";
msgBuffer = msgBuffer # zeile6 # splitter # color6 # splitter # icon6;
string substitutions = "A,0x41\tB,0x42\tC,0x43\tD,0x44\tE,0x45\tF,0x46\tG,0x47\tH,0x48\tI,0x49\tJ,0x4A\tK,0x4B\tL,0x4C\tM,0x4D\tN,0x4E\tO,0x4F\tP,0x50\tQ,0x51\tR,0x52\tS,0x53\tT,0x54\tU,0x55\tV,0x56\tW,0x57\tX,0x58\tY,0x59\tZ,0x5A";
substitutions = substitutions # "\ta,0x61\tb,0x62\tc,0x63\td,0x64\te,0x65\tf,0x66\tg,0x67\th,0x68\ti,0x69\tj,0x6A\tk,0x6B\tl,0x6C\tm,0x6D\tn,0x6E\to,0x6F\tp,0x70\tq,0x71\tr,0x72\ts,0x73\tt,0x74\tu,0x75\tv,0x76\tw,0x77\tx,0x78\ty,0x79\tz,0x7A";
substitutions = substitutions # "\t0,0x30\t1,0x31\t2,0x32\t3,0x33\t4,0x34\t5,0x35\t6,0x36\t7,0x37\t8,0x38\t9,0x39\t ,0x20\t!,0x21\t\",0x22\t%,0x25\t&,0x26\t=,0x27\t(,0x28\t),0x29\t*,0x2A\t+,0x2B\t,,0x2C\t-,0x2D\t.,0x2E\t/,0x2F";
substitutions = substitutions # "\tÄ,0x5B\tÖ,0x23\tÜ,0x24\tä,0x7B\tö,0x7C\tü,0x7D\tß,0x5F\t:,0x3A\t;,0x3B\t@,0x40\t>,0x3E";
string bufferLine;
string substEntry;
integer i;
string char;
string line;
string icon;
string command = "0x02";
foreach(bufferLine, msgBuffer) {
line = bufferLine.StrValueByIndex(splitter, 0);
icon = bufferLine.StrValueByIndex(splitter, 2);
if ((line <> "") || (icon <> "")) {
command = command # ",0x12";
if ((line.Substr(0,2) == "0x") && (line.Length() == 4)) {
command = command # "," # line;
i = 12;
}
else {
i = 0;
}
while ((i < line.Length()) && (i < 12)) {
char = line.Substr(i, 1);
foreach(substEntry, substitutions){
if (char == substEntry.Substr(0,1)){command = command # substEntry.Substr(1,5);}
}
i = i + 1;
}
command = command # ",0x11," # bufferLine.StrValueByIndex(splitter, 1);
if (icon <> "") {
command = command # ",0x13," # icon;
}
}
command = command # ",0x0A";
}
command = command # ",0x03";
dom.GetObject("BidCos-RF." # dom.GetObject("$src$").Name().StrValueByIndex(".",1) # ".SUBMIT").State(command);