Ankündigung

Einklappen
Keine Ankündigung bisher.

iTunes | Steuerung via Script über WebServer | Edomi

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    Bin ich am richtigen Weg ?

    PHP-Code:
    ###[LBS]###

    <?php

    function LB_LBSID($id) {

        if (
    $E[2]['refresh']==1) {
            
    setLogicElementVar($id,2,1);    // PLAY
            
    setLogicElementVar($id,3,0);    // PAUSE
            
    setLogicElementVar($id,4,0);    // STOP
        
    }
        if (
    $E[3]['refresh']==1) {
            
    setLogicElementVar($id,2,0);    // PLAY
            
    setLogicElementVar($id,3,1);    // PAUSE
            
    setLogicElementVar($id,4,0);    // STOP
        
    }
        if (
    $E[4]['refresh']==1) {
            
    setLogicElementVar($id,2,0);    // PLAY
            
    setLogicElementVar($id,3,0);    // PAUSE
            
    setLogicElementVar($id,4,1);    // STOP
        
    }


        if (
    getLogicElementVar($id,1)!=1) {
            
    setLogicElementVar($id,1,1);
            
    callLogicFunctionExec(LBSID,$id);
        }
    }

    ?>

    ###[/LBS]###

    PHP-Code:
    //    ---- HTTP-Requests | kein UDP-Paket empfangen | http SENDEN:
                                           
                        
    if ($E=getLogicEingangDataAll($id)) {
                      

                                    
    $url "http://".$E[34]['value']."/%7E".$E[33]['value']."/iControl.php?c=";
                                    

    //    ---- HTTP-Requests | iTunes | Steuerung:

                                    
    if (getLogicElementVar($id,2) == 1) {
                                        if (
    $E[8]['value'] == 1) {
                                            
    $ctx=stream_context_create(array('http' => array('timeout' => )));
                                            
    $r=file_get_contents($url.'play&p1=fadein&p2='.$E[9]['value'],0,$ctx);
                                            
    writeToTraceLog(0,true,'iTunes E02 URL  :'.$url.'play&p1='.$E[8]['value'].'&p2='.$E[9]['value'].' / ctx '.$ctx);
                                        } else {
                                            
    $ctx=stream_context_create(array('http' => array('timeout' => )));
                                            
    $r=file_get_contents($url.'play',0,$ctx);
                                            
    writeToTraceLog(0,true,'iTunes E02 URL  :'.$url.'play' ctx '.$ctx);
                                        }
                                    }
                                } 
    Danke und LG, Dariusz
    GIRA | ENERTEX | MDT | MEANWELL | 24VDC LED | iBEMI | EDOMI | ETS5 | DS214+ | KNX/RS232-GW-ROTEL

    Kommentar


      Hey, ich finde, das sieht doch ganz gut so aus. So sollten die refresh-Werte verlässlich in den EXEC-Teil kommen können. Klappt es denn?

      Kommentar


        Der Grundgedanke ist richtig - nur musst Du im EXEC-Teil die ganzen Variablen natürlich wieder zurücksetzen Die Variablen behalten ja sonst ihren Wert und sorgen für ein "Dauersenden"...
        EDOMI - Intelligente Steuerung und Visualisierung KNX-basierter Elektro-Installationen (http://www.edomi.de)

        Kommentar


          Ich habe es gestern ma so gemacht ...

          a) zusätzlich mit ‚value‘ damit nur eine „1“ das Telegramm auslöst, den nur mit ‚refresh‘ würde auch die „0“ auslösen …
          b) eben die Variable eingebaut, damit das Telegramm nich dauersendet ...

          PHP-Code:
          ###[LBS]###

          <?php

          function LB_LBSID($id) {

              if (
          $E=getLogicEingangDataAll($id)) {

                  if ((
          $E[2]['value'] == 1) && ($E[2]['refresh'] == 1)) {
                      
          setLogicElementVar($id,2,1);    // PLAY
                      
          setLogicElementVar($id,3,0);    // PAUSE
                      
          setLogicElementVar($id,4,0);    // STOP
                  
          }

                  if ((
          $E[3]['value'] == 1) && ($E[3]['refresh'] == 1)) {
                      
          setLogicElementVar($id,2,0);    // PLAY
                      
          setLogicElementVar($id,3,1);    // PAUSE
                      
          setLogicElementVar($id,4,0);    // STOP
                  
          }

                  if ((
          $E[4]['value'] == 1) && ($E[4]['refresh'] == 1)) {
                      
          setLogicElementVar($id,2,0);    // PLAY
                      
          setLogicElementVar($id,3,0);    // PAUSE
                      
          setLogicElementVar($id,4,1);    // STOP
                  
          }

                  if ((
          $E[5]['value'] == 1) && ($E[5]['refresh'] == 1)) {
                      
          setLogicElementVar($id,5,1);    // FF/NEXT
                  
          }

                  if ((
          $E[6]['value'] == 1) && ($E[6]['refresh'] == 1)) {
                      
          setLogicElementVar($id,6,1);    // FR/BACK
                  
          }
              }

              if (
          getLogicElementVar($id,1)!=1) {
                  
          setLogicElementVar($id,1,1);
                  
          callLogicFunctionExec(LBSID,$id);
              }
          }

          ?>

          ###[/LBS]###

          EXEC-Ausschnitt
          PHP-Code:
          //    ---- HTTP-Requests | kein UDP-Paket empfangen | http SENDEN:
                                                
                              
          if ($E=getLogicEingangDataAll($id)) {
                              
          //                         if (!isEmpty($E[34]['value'])) {
          //                             if (filter_var($E[34]['value'],FILTER_VALIDATE_IP,FILTER_FLAG_IPV4) !==false) {          // IPv4-Format?
          //                                 if (is_int($E[32]['value']) !==false) {                                                // Zahl?

                                          
          $url "http://".$E[34]['value']."/%7E".$E[33]['value']."/iControl.php?c=";
                                          

          //    ---- HTTP-Requests | iTunes | Steuerung:
                                              
          //                                PLAY: mit &p1=fadein / &p2=3 [s] Verzögerung | 'play' erwartet "1"

                                          
          if (getLogicElementVar($id,2) == 1) {
                                              if (
          $E[8]['value'] == 1) {
                                                  
          $ctx=stream_context_create(array('http' => array('timeout' => )));
                                                  
          $r=file_get_contents($url.'play&p1=fadein&p2='.$E[9]['value'],0,$ctx);
                                                  
          writeToTraceLog(0,true,'iTunes E02 URL  :'.$url.'play&p1=fadein'.'&p2='.$E[9]['value'].' / ctx '.$ctx);
                                              } else {
                                                  
          $ctx=stream_context_create(array('http' => array('timeout' => )));
                                                  
          $r=file_get_contents($url.'play',0,$ctx);
                                                  
          writeToTraceLog(0,true,'iTunes E02 URL  :'.$url.'play'.' / ctx '.$ctx);
                                              }
                                              
          setLogicElementVar($id,2) == 0;
                                          }
                                              
          //                                PAUSE: | 'pause' | erwartet "1"

                                          
          if (getLogicElementVar($id,3) == 1) {
                                              
          $ctx=stream_context_create(array('http' => array('timeout' => )));
                                              
          $r=file_get_contents($url.'pause',0,$ctx);
                                              
          writeToTraceLog(0,true,'iTunes E03 URL  :'.$url.'pause'.' / ctx '.$ctx);
                                              
          setLogicElementVar($id,3) == 0;
                                          }

          //                                STOP: | 'stop' | erwartet "1"

                                          
          if (getLogicElementVar($id,4) == 1) {
                                              
          $ctx=stream_context_create(array('http' => array('timeout' => )));
                                              
          $r=file_get_contents($url.'stop',0,$ctx);
                                              
          writeToTraceLog(0,true,'iTunes E04 URL  :'.$url.'stop'.' / ctx '.$ctx);
                                              
          setLogicElementVar($id,4) == 0;
                                          }

          //                              NEXT: | 'next' | erwartet "1"

                                          
          if (getLogicElementVar($id,5) == 1) {
                                              
          $ctx=stream_context_create(array('http' => array('timeout' => )));
                                              
          $r=file_get_contents($url.'next',0,$ctx);
                                              
          writeToTraceLog(0,true,'iTunes E05 URL  :'.$url.'next'.' / ctx '.$ctx);
                                              
          setLogicElementVar($id,5) == 0;
                                              }

          //                              BACK: | 'back' | erwartet "1"

                                          
          if (getLogicElementVar($id,6) == 1) {
                                              
          $ctx=stream_context_create(array('http' => array('timeout' => )));
                                              
          $r=file_get_contents($url.'back',0,$ctx);
                                              
          writeToTraceLog(0,true,'iTunes E06 URL  :'.$url.'back'.' / ctx '.$ctx);
                                              
          setLogicElementVar($id,6) == 0;
                                              }

          //                                MASTER Volume | 'mainVolume' | z.B. Wert 45 übergeben

                                          
          if ($alterWertE07 != $E[7]['value']) {
                                              
          writeToTraceLog(0,true,'iTunes E07 Wert: '.$E[7]['value']);
                                              
          $ctx=stream_context_create(array('http' => array('timeout' => )));
                                              
          $r=file_get_contents($url.'mainVolume&p1='.$E[7]['value'],0,$ctx);
                                              
          writeToTraceLog(0,true,'iTunes E07 Name: Master Volume');
                                              
          writeToTraceLog(0,true,'iTunes E07 URL  : '.$url.'mainVolume&p1='.$E[7]['value'].' / ctx '.$ctx);
                                              
          $alterWertE07 $E[7]['value'];
                                          } 
          Danke und LG, Dariusz
          GIRA | ENERTEX | MDT | MEANWELL | 24VDC LED | iBEMI | EDOMI | ETS5 | DS214+ | KNX/RS232-GW-ROTEL

          Kommentar


            So ist er braaaav...
            EDOMI - Intelligente Steuerung und Visualisierung KNX-basierter Elektro-Installationen (http://www.edomi.de)

            Kommentar


              Hallo Christian,

              der unten stehende Apple-Skript funktioniert mit „Toggle“, d.h., jedes Mal wenn ich aus Edomi den HTTP-Request sende - z.B.:

              http://…..?c=apDevice&p1=Computer

              dann wird der Computer-Lautsprecher ein- oder ausgeschaltet (natürlich nur wenn ein anderer AirPlay-Lautsprecher an ist - ist beim internen Lautsprecher so) ...

              Mit der Logik im LBS schicke ich nur eine 1 und diese 1 ist durch „alterWert“ abgesichert damit das URL nicht kontinuierlich x-Mal / Sekunde abgeschickt wird ...

              Das bedeutet aber auch, dass nach der ersten 1, keine 1 mehr gesendet werden kann (außer es wird vorher eine 0 auf den Bus geschickt …), somit ist das „Toggeln“ nicht möglich, somit das ein- und ausschalten des Lautsprechers auch nicht :-(

              Hast du eine Idee bevor ich mit wieder ein Woche lang den Kopf zerbreche ?


              DANKE !!


              EXEC-Teil
              PHP-Code:
              $alterWertE10 ' '

              while ...

              if (
              $alterWertE10 != $E[10]['value']) {
              writeToTraceLog(0,true,'iTunes E10 Wert: '.$E[10]['value']);
              if (!
              isEmpty($E[35]['value'])) {
              writeToTraceLog(0,true,'iTunes E10 Leer: '.!isEmpty($E[35]['value']));
              writeToTraceLog(0,true,'iTunes E10 Name: '.$E[35]['value']);
              $ctx=stream_context_create(array('http' => array('timeout' => )));
              $r=file_get_contents($url.'apDevice&p1='.$E[35]['value'],0,$ctx);
              writeToTraceLog(0,true,'iTunes E10 URL : '.$url.'apDevice&p1='.$E[35]['value'].' / ctx '.$ctx);
              }
              $alterWertE10 $E[10]['value'];



              Apple-Skript
              Code:
               [FONT=Courier New][SIZE=12px][B]on[/B] [COLOR=#0433ff][B]run[/B][/COLOR] [COLOR=#4f8f00]argv[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# hier wird der angefragte AirPlayLs übernommen[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]MyDevice[/COLOR] [B]to[/B] [COLOR=#0433ff][I]item[/I][/COLOR] 1 [B]of[/B] [COLOR=#4f8f00]argv[/COLOR] [B]as[/B] [COLOR=#0433ff][I]text[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# hier wird geprüft ob der angefragte AirPlayLS der lokale LS (Computer) ist[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]if[/B] [COLOR=#4f8f00]MyDevice[/COLOR] = "Local" [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]        [B]set[/B] [COLOR=#4f8f00]MyDevice[/COLOR] [B]to[/B] "Computer"[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]        [B]set[/B] [COLOR=#4f8f00]LocalPlay[/COLOR] [B]to[/B] 1 [B]as[/B] [COLOR=#0433ff][I]number[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]else[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]        [B]set[/B] [COLOR=#4f8f00]LocalPlay[/COLOR] [B]to[/B] 0 [B]as[/B] [COLOR=#0433ff][I]number[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# [/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]DebugMode[/COLOR] [B]to[/B] 0 [B]as[/B] [COLOR=#0433ff][I]number[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]SendFeedback[/COLOR] [B]to[/B] 0 [B]as[/B] [COLOR=#0433ff][I]number[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# Der Pfad zur HsRepeat.conf[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]infopath[/COLOR] [B]to[/B] ([COLOR=#012FBE][FONT=Courier][B]path to[/B][/FONT][/COLOR] [COLOR=#5730be][I]applications folder[/I][/COLOR]) & "MiniMMC:HsRepeat:HsRepeat.conf" [B]as[/B] [COLOR=#0433ff][I]string[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# Prüfung ob der Pfad existiert ...[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]tell[/B] [COLOR=#0433ff][I]application[/I][/COLOR] "Finder"[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]        [B]if[/B] [COLOR=#0433ff][B]exists[/B][/COLOR] [COLOR=#0433ff][I]file[/I][/COLOR] [COLOR=#4f8f00]infopath[/COLOR] [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]            [B]try[/B][/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                [/COLOR]# [/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                [B]set[/B] [COLOR=#4f8f00]OpenMyFile[/COLOR] [B]to[/B] [COLOR=#012FBE][FONT=Courier][B]open for access[/B][/FONT][/COLOR] [COLOR=#4f8f00]infopath[/COLOR] [B]as[/B] «[COLOR=#0433ff][I]class[/I][/COLOR] utf8»[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [B]set[/B] [COLOR=#4f8f00]clsettings[/COLOR] [B]to[/B] [COLOR=#012FBE][FONT=Courier][B]read[/B][/FONT][/COLOR] [COLOR=#4f8f00]OpenMyFile[/COLOR] [COLOR=#012FBE][FONT=Verdana]as[/FONT][/COLOR] «[COLOR=#0433ff][I]class[/I][/COLOR] utf8»[/SIZE][/FONT]
                [COLOR=#012FBE][FONT=Courier New][SIZE=12px][COLOR=#000000]                [/COLOR][FONT=Courier][B]close access[/B][/FONT][COLOR=#000000] [/COLOR][COLOR=#4f8f00]OpenMyFile[/COLOR][/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]            [B]on[/B] [B]error[/B][/SIZE][/FONT]
                [COLOR=#012FBE][FONT=Courier New][SIZE=12px][COLOR=#000000]                [/COLOR][FONT=Courier][B]close access[/B][/FONT][COLOR=#000000] [/COLOR][COLOR=#4f8f00]OpenMyFile[/COLOR][/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]            [B]end[/B] [B]try[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]        [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]end[/B] [B]tell[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# Übernimmt aus der HsRepeat.conf die 1. Zeile die, IP uws.[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]hsEMPFANG[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 1 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR] [B]as[/B] [COLOR=#0433ff][I]text[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]DebugMode[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 3 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR] [B]as[/B] [COLOR=#0433ff][I]number[/I][/COLOR][/SIZE][/FONT]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [/COLOR]SendFeedback[COLOR=#000000] [B]to[/B] [/COLOR][COLOR=#0433ff][I]paragraph[/I][/COLOR][COLOR=#000000] 24 [B]of[/B] [/COLOR]clsettings[COLOR=#000000] [B]as[/B] [/COLOR][COLOR=#0433ff][I]number[/I][/COLOR][/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]notRunning[/COLOR] [B]to[/B] "echo 'iTunes0' " & [COLOR=#4f8f00]hsEMPFANG[/COLOR] [B]as[/B] [COLOR=#0433ff][I]text[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]CMDtoSend[/COLOR] [B]to[/B] "echo '"[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# Auslesung der AirPlay Namen aus der HsRepeat.conf und Zuweisung zu einer Variable[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf10[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 6 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf11[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 7 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf12[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 8 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf13[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 9 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf14[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 10 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf15[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 11 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf16[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 12 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf17[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 13 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf18[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 14 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]tf19[/COLOR] [B]to[/B] [COLOR=#0433ff][I]paragraph[/I][/COLOR] 15 [B]of[/B] [COLOR=#4f8f00]clsettings[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# Übergabe an ein Array [/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] {}[/COLOR][/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf10[/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf11[/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf12[/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf13[/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf14[/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf15[/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf16[/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf17[/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf18[/SIZE][/FONT][/COLOR]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]    [B]set[/B] [B]the[/B] [B]end[/B] [B]of[/B] [/COLOR]MyAirplaySpeakerNames[COLOR=#000000] [B]to[/B] [/COLOR]tf19[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# Erstellung eines Array mit den Teilstring für die 10 AirPlay Lautsprecher[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]set[/B] [COLOR=#4f8f00]MyAirplaySpeakerKeys[/COLOR] [B]to[/B] {"LS1=", "&LS2=", "&LS3=", "&LS4=", "&LS5=", "&LS6=", "&LS7=", "&LS8=", "&LS9=", "&LS10="}[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# display dialog MyAirplaySpeakerKeys[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]    [/COLOR]# Prüft ob iTunes läuft ...[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]    [B]tell[/B] [COLOR=#0433ff][I]application[/I][/COLOR] "System Events"[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]        [B]get[/B] [COLOR=#812fdc]name[/COLOR] [B]of[/B] [B]every[/B] [COLOR=#0433ff][I]process[/I][/COLOR][/SIZE][/FONT]
                [COLOR=#0433FF][FONT=Courier New][SIZE=12px][COLOR=#000000]        [B]if[/B] [/COLOR][B]exists[/B][COLOR=#000000] [/COLOR][I]application process[/I][COLOR=#000000] "iTunes" [B]then[/B][/COLOR][/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]            [B]tell[/B] [COLOR=#0433ff][I]application[/I][/COLOR] "iTunes"[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                [/COLOR]# [/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                [B]set[/B] [COLOR=#4f8f00]apPlays[/COLOR] [B]to[/B] {}[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [B]set[/B] [COLOR=#4f8f00]apPlaysIDS[/COLOR] [B]to[/B] {}[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [B]set[/B] [COLOR=#4f8f00]MyDeviceID[/COLOR] [B]to[/B] ""[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [B]set[/B] [COLOR=#4f8f00]LocalPlayID[/COLOR] [B]to[/B] ""[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [B]set[/B] [COLOR=#4f8f00]isActive[/COLOR] [B]to[/B] 0 [B]as[/B] [COLOR=#0433ff][I]number[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                [/COLOR]# Abfrage aller AirPlay Namen[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                [B]set[/B] [COLOR=#4f8f00]apNames[/COLOR] [B]to[/B] ([B]get[/B] [COLOR=#812fdc]name[/COLOR] [B]of[/B] [COLOR=#0433ff][I]AirPlay devices[/I][/COLOR])[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                [/COLOR]# Abfrage aller AirPlay IDs[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                [B]set[/B] [COLOR=#4f8f00]apDevices[/COLOR] [B]to[/B] ([B]get[/B] [COLOR=#0433ff][I]AirPlay devices[/I][/COLOR])[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                [/COLOR]# Wenn der übergebene AirPlay Name in der Liste gefunden wurde dann wird der Name[/SIZE][/FONT][/COLOR]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                [/COLOR]# als aktueller LS übernommen und in der apActs gespeichert[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                [B]if[/B] [COLOR=#4f8f00]MyDevice[/COLOR] [B]is[/B] [B]in[/B] [COLOR=#4f8f00]apNames[/COLOR] [B]then[/B][/SIZE][/FONT]
                [COLOR=#812FDC][FONT=Courier New][SIZE=12px][COLOR=#000000]                    [B]set[/B] [/COLOR][COLOR=#4f8f00]apActs[/COLOR][COLOR=#000000] [B]to[/B] [/COLOR]current AirPlay devices[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                    [/COLOR]# for-it-schleife ...[/SIZE][/FONT][/COLOR]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                    [/COLOR]# Überprüfung ob übernommener AirPlay-Name (item) aus der Liste der Lautsprecher[/SIZE][/FONT][/COLOR]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                    [/COLOR]# (apNames) in MyDevice-Variable ist ...[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                    [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]i[/COLOR] [B]from[/B] 1 [B]to[/B] [COLOR=#812fdc]length[/COLOR] [B]of[/B] [COLOR=#4f8f00]apNames[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]if[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]apNames[/COLOR] [B]is[/B] [B]in[/B] [COLOR=#4f8f00]MyDevice[/COLOR] [B]then[/B] [B]set[/B] [COLOR=#4f8f00]MyDeviceID[/COLOR] [B]to[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]apDevices[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                    [/COLOR]# [/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                    [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]aDevice[/COLOR] [B]in[/B] [COLOR=#4f8f00]apActs[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]set[/B] [COLOR=#4f8f00]apName[/COLOR] [B]to[/B] ([B]get[/B] [COLOR=#4f8f00]aDevice's[/COLOR] [COLOR=#812fdc]name[/COLOR])[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]if[/B] [COLOR=#4f8f00]MyDevice[/COLOR] [B]is[/B] [COLOR=#4f8f00]apName[/COLOR] [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]set[/B] [COLOR=#4f8f00]isActive[/COLOR] [B]to[/B] 1 [B]as[/B] [COLOR=#0433ff][I]number[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [COLOR=#5e6161]# [/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]aDevice[/COLOR] [B]in[/B] [COLOR=#4f8f00]apActs[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]set[/B] [COLOR=#4f8f00]apName[/COLOR] [B]to[/B] ([B]get[/B] [COLOR=#4f8f00]aDevice's[/COLOR] [COLOR=#812fdc]name[/COLOR])[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]if[/B] [COLOR=#4f8f00]isActive[/COLOR] = 1 [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]if[/B] [COLOR=#4f8f00]MyDevice[/COLOR] [B]is not[/B] [B]in[/B] [COLOR=#4f8f00]apName[/COLOR] [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                [B]set[/B] [B]end[/B] [B]of[/B] [COLOR=#4f8f00]apPlays[/COLOR] [B]to[/B] [COLOR=#4f8f00]apName[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]else[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]set[/B] [B]end[/B] [B]of[/B] [COLOR=#4f8f00]apPlays[/COLOR] [B]to[/B] [COLOR=#4f8f00]apName[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]if[/B] [COLOR=#4f8f00]isActive[/COLOR] = 0 [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]set[/B] [B]end[/B] [B]of[/B] [COLOR=#4f8f00]apPlays[/COLOR] [B]to[/B] [COLOR=#4f8f00]MyDevice[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]i[/COLOR] [B]from[/B] 1 [B]to[/B] [COLOR=#812fdc]length[/COLOR] [B]of[/B] [COLOR=#4f8f00]apNames[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]if[/B] [COLOR=#4f8f00]LocalPlay[/COLOR] = 0 [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]v[/COLOR] [B]from[/B] 1 [B]to[/B] [COLOR=#812fdc]length[/COLOR] [B]of[/B] [COLOR=#4f8f00]apPlays[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                [B]if[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]apNames[/COLOR] [B]is[/B] [B]in[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]v[/COLOR] [B]of[/B] [COLOR=#4f8f00]apPlays[/COLOR] [B]then[/B] [B]set[/B] [B]end[/B] [B]of[/B] [COLOR=#4f8f00]apPlaysIDS[/COLOR] [B]to[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]apDevices[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]else[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]v[/COLOR] [B]from[/B] 1 [B]to[/B] [COLOR=#812fdc]length[/COLOR] [B]of[/B] [COLOR=#4f8f00]apPlays[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                [B]if[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]apNames[/COLOR] [B]is[/B] [B]in[/B] [COLOR=#4f8f00]MyDevice[/COLOR] [B]then[/B] [B]set[/B] [COLOR=#4f8f00]apPlaysIDS[/COLOR] [B]to[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]apDevices[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]set[/B] [COLOR=#4f8f00]i[/COLOR] [B]to[/B] [COLOR=#0433ff][B]count[/B][/COLOR] [B]of[/B] [COLOR=#0433ff][I]items[/I][/COLOR] [B]in[/B] [COLOR=#4f8f00]apPlaysIDS[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]if[/B] [COLOR=#4f8f00]i[/COLOR] = 0 [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]i[/COLOR] [B]from[/B] 1 [B]to[/B] [COLOR=#812fdc]length[/COLOR] [B]of[/B] [COLOR=#4f8f00]apNames[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]if[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]apNames[/COLOR] = "Computer" [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                [B]set[/B] [COLOR=#4f8f00]LocalPlayID[/COLOR] [B]to[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]apDevices[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]                        [B]set[/B] [/COLOR]apPlaysIDS[COLOR=#000000] [B]to[/B] [/COLOR]LocalPlayID[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                    [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [COLOR=#812FDC][FONT=Courier New][SIZE=12px][COLOR=#000000]                    [B]set[/B] [/COLOR]current AirPlay devices[COLOR=#000000] [B]to[/B] [/COLOR][COLOR=#4f8f00]apPlaysIDS[/COLOR][/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [COLOR=#012FBE][FONT=Courier][B]do shell script[/B][/FONT][/COLOR] "sleep 0.5"[/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [COLOR=#812FDC][FONT=Courier New][SIZE=12px][COLOR=#000000]                    [B]set[/B] [/COLOR][COLOR=#4f8f00]apActs[/COLOR][COLOR=#000000] [B]to[/B] [/COLOR]current AirPlay devices[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]i[/COLOR] [B]from[/B] 1 [B]to[/B] [COLOR=#812fdc]length[/COLOR] [B]of[/B] [COLOR=#4f8f00]MyAirplaySpeakerNames[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]set[/B] [COLOR=#4f8f00]CurState[/COLOR] [B]to[/B] "0" [B]as[/B] [COLOR=#0433ff][I]text[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]if[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]MyAirplaySpeakerNames[/COLOR] = "0" [B]then[/B][/SIZE][/FONT]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]                            [B]set[/B] [/COLOR]CMDtoSend[COLOR=#000000] [B]to[/B] [/COLOR]CMDtoSend[COLOR=#000000] & [/COLOR][COLOR=#0433ff][I]item[/I][/COLOR][COLOR=#000000] [/COLOR]i[COLOR=#000000] [B]of[/B] [/COLOR]MyAirplaySpeakerKeys[COLOR=#000000] & [/COLOR]CurState[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                        [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                        [/COLOR]#display dialog CMDtoSend & "' " & hsEMPFANG as text[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                        [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]x[/COLOR] [B]from[/B] 1 [B]to[/B] [COLOR=#812fdc]length[/COLOR] [B]of[/B] [COLOR=#4f8f00]apNames[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]if[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]MyAirplaySpeakerNames[/COLOR] [B]is[/B] [B]in[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]x[/COLOR] [B]of[/B] [COLOR=#4f8f00]apNames[/COLOR] [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                [B]set[/B] [COLOR=#4f8f00]MyDeviceID[/COLOR] [B]to[/B] [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]i[/COLOR] [B]of[/B] [COLOR=#4f8f00]apDevices[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]z[/COLOR] [B]from[/B] 1 [B]to[/B] [COLOR=#812fdc]length[/COLOR] [B]of[/B] [COLOR=#4f8f00]apActs[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                    [B]if[/B] [COLOR=#4f8f00]MyDeviceID[/COLOR] = [COLOR=#0433ff][I]item[/I][/COLOR] [COLOR=#4f8f00]z[/COLOR] [B]of[/B] [COLOR=#4f8f00]apActs[/COLOR] [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                        [B]set[/B] [COLOR=#4f8f00]CurState[/COLOR] [B]to[/B] "1" [B]as[/B] [COLOR=#0433ff][I]text[/I][/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                    [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                                [/COLOR]#set cCounter to 3 - (length of CurVol)[/SIZE][/FONT][/COLOR]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                                [/COLOR]#repeat cCounter times[/SIZE][/FONT][/COLOR]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                                [/COLOR]#    set CurVol to "0" & CurVol as text[/SIZE][/FONT][/COLOR]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                                [/COLOR]#end repeat[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                                [/SIZE][/FONT]
                [COLOR=#4F8F00][FONT=Courier New][SIZE=12px][COLOR=#000000]                                [B]set[/B] [/COLOR]CMDtoSend[COLOR=#000000] [B]to[/B] [/COLOR]CMDtoSend[COLOR=#000000] & [/COLOR][COLOR=#0433ff][I]item[/I][/COLOR][COLOR=#000000] [/COLOR]i[COLOR=#000000] [B]of[/B] [/COLOR]MyAirplaySpeakerKeys[COLOR=#000000] & [/COLOR]CurState[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                                [/SIZE][/FONT]
                [COLOR=#5E6161][FONT=Courier New][SIZE=12px][COLOR=#000000]                                [/COLOR]#display dialog CMDtoSend & "' " & hsEMPFANG as text[/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                                [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                                [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]end[/B] [B]repeat[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]if[/B] [COLOR=#4f8f00]SendFeedback[/COLOR] = 1 [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]if[/B] [COLOR=#4f8f00]DebugMode[/COLOR] = 1 [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [COLOR=#012FBE][FONT=Courier][B]display dialog[/B][/FONT][/COLOR] [COLOR=#4f8f00]CMDtoSend[/COLOR] & "' " & [COLOR=#4f8f00]hsEMPFANG[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]else[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                            [COLOR=#012FBE][FONT=Courier][B]do shell script[/B][/FONT][/COLOR] [COLOR=#4f8f00]CMDtoSend[/COLOR] & "' " & [COLOR=#4f8f00]hsEMPFANG[/COLOR][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                        [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                    [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]            [B]end[/B] [B]tell[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]        [B]else[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]            [B]if[/B] [COLOR=#4f8f00]SendFeedback[/COLOR] = 1 [B]then[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]                [B]if[/B] [COLOR=#4f8f00]DebugMode[/COLOR] = 1 [B]then[/B][/SIZE][/FONT]
                [COLOR=#012FBE][FONT=Courier New][SIZE=12px][COLOR=#000000]                    [/COLOR][FONT=Courier][B]display dialog[/B][/FONT][COLOR=#000000] [/COLOR][COLOR=#4f8f00]notRunning[/COLOR][/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                [B]else[/B][/SIZE][/FONT]
                [COLOR=#012FBE][FONT=Courier New][SIZE=12px][COLOR=#000000]                    [/COLOR][FONT=Courier][B]do shell script[/B][/FONT][COLOR=#000000] [/COLOR][COLOR=#4f8f00]notRunning[/COLOR][/SIZE][/FONT][/COLOR]
                [FONT=Courier New][SIZE=12px]                [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]            [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]        [B]end[/B] [B]if[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px]    [B]end[/B] [B]tell[/B][/SIZE][/FONT]
                [FONT=Courier New][SIZE=12px][B]end[/B] [COLOR=#0433ff][B]run[/B][/COLOR][/SIZE][/FONT]
              Danke und LG, Dariusz
              GIRA | ENERTEX | MDT | MEANWELL | 24VDC LED | iBEMI | EDOMI | ETS5 | DS214+ | KNX/RS232-GW-ROTEL

              Kommentar


                Naja, wie schon gesagt wäre die "saubere" Lösung die gesamte "Logik" in den dafür gedachten LBS-Abschnitt zu verlagern... Sprich: Wenn ein neues "Telegramm" an E# eintrifft (refresh) wird eine Variable V# entsprechend gesetzt oder nicht gesetzt. Der EXEC-Teil wertet dann ausschließlich(!) diese Variablen aus, hat also mit $E nichts am Hut. Oder anders ausgedrückt: Der gesamte LBS ist quasi in 2 Teile gegliedert: Der LBS-Teil macht die Logik (wenn-dann), der EXEC-Teil verrichtet die eigentliche Arbeit (Senden und Empfangen von HTTP/UDP).
                EDOMI - Intelligente Steuerung und Visualisierung KNX-basierter Elektro-Installationen (http://www.edomi.de)

                Kommentar


                  LBS:
                  PHP-Code:
                          if (($E[19]['value'] == 1) && ($E[19]['refresh'] == 1)) {
                              
                  writeToTraceLog(0,true,'iTunes | E19 | Toggle : '.$E[19]['value']);
                              if (!
                  isEmpty($E[44]['value'])) {
                                  
                  writeToTraceLog(0,true,'iTunes | E19 | exists : '.!isEmpty($E[44]['value']));
                                  
                  writeToTraceLog(0,true,'iTunes | E19 | LsName : '.$E[44]['value']);
                                  
                  setLogicElementVar($id,19,1);    // LS10 ein/aus
                              
                  }
                          }
                      }

                      if (
                  getLogicElementVar($id,1)!=1) {
                          
                  setLogicElementVar($id,1,1);
                          
                  callLogicFunctionExec(LBSID,$id);
                      } 

                  EXEC:
                  PHP-Code:
                  if (getLogicElementVar($id,19) == 1) {
                      
                  writeToTraceLog(0,true,'iTunes | E19 | Var = '.getLogicElementVar($id,19));
                      
                  $ctx=stream_context_create(array('http' => array('timeout' => )));
                      
                  $r=file_get_contents($url.'apDevice&p1='.$E[44]['value'],0,$ctx);
                      
                  writeToTraceLog(0,true,'iTunes | E19 | URL = '.$url.'apDevice&p1='.$E[44]['value'].' / ctx '.$ctx);
                      
                  setLogicElementVar($id,19) == 0;
                      
                  writeToTraceLog(0,true,'iTunes | E19 | Var = '.getLogicElementVar($id,19));


                  Trace-Log:
                  Code:
                  2016-02-16 13:08:46    634510    EXEC    5489    iTunes | E11 | Toggle : 1    Ok
                  2016-02-16 13:08:46    634597    EXEC    5489    iTunes | E11 | exists : 1    Ok
                  2016-02-16 13:08:46    634624    EXEC    5489    iTunes | E11 | LsName : ATV    Ok
                  2016-02-16 13:08:46    641437    EXEC    5502    iTunes | E11 | Var = 1    Ok
                  2016-02-16 13:08:49    037026    EXEC    5502    iTunes | E11 | URL = http://10.0.100.150/%7Edariusz/eDOMI.php?c=apDevice&p1=ATV / ctx Resource id #60786    Ok
                  2016-02-16 13:08:49    037626    EXEC    5502    iTunes | E11 | Var =    Ok
                  2016-02-16 13:08:49    140600    EXEC    5502    iTunes RM | A10 | LS01 exists = 1    Ok
                  2016-02-16 13:08:49    140683    EXEC    5502    iTunes RM | A10 | LS01 output = 1    Ok
                  2016-02-16 13:08:49    140824    EXEC    5502    iTunes RM | A11 | LS02 exists = 1    Ok
                  2016-02-16 13:08:49    140959    EXEC    5502    iTunes RM | A11 | LS02 output = 1    Ok
                  2016-02-16 13:08:49    141094    EXEC    5502    iTunes RM | A12 | LS03 exists = 1    Ok
                  2016-02-16 13:08:49    141129    EXEC    5502    iTunes RM | A12 | LS03 output =    Ok
                  2016-02-16 13:08:49    141400    EXEC    5502    iTunes RM | A13 | LS04 exists = 1    Ok
                  2016-02-16 13:08:49    141438    EXEC    5502    iTunes RM | A13 | LS04 output =    Ok
                  2016-02-16 13:08:49    141541    EXEC    5502    iTunes RM | A14 | LS05 exists = 1    Ok
                  2016-02-16 13:08:49    141575    EXEC    5502    iTunes RM | A14 | LS05 output =    Ok
                  2016-02-16 13:08:49    141675    EXEC    5502    iTunes RM | A15 | LS06 exists = 1    Ok
                  2016-02-16 13:08:49    141709    EXEC    5502    iTunes RM | A15 | LS06 output =    Ok
                  2016-02-16 13:08:49    141808    EXEC    5502    iTunes RM | A16 | LS07 exists = 1    Ok
                  2016-02-16 13:08:49    141885    EXEC    5502    iTunes RM | A16 | LS07 output =    Ok
                  2016-02-16 13:08:49    141988    EXEC    5502    iTunes RM | A17 | LS08 exists = 1    Ok
                  2016-02-16 13:08:49    142021    EXEC    5502    iTunes RM | A17 | LS08 output =    Ok
                  2016-02-16 13:08:49    142119    EXEC    5502    iTunes RM | A18 | LS09 exists = 1    Ok
                  2016-02-16 13:08:49    142153    EXEC    5502    iTunes RM | A18 | LS09 output =    Ok
                  2016-02-16 13:08:49    142250    EXEC    5502    iTunes RM | A19 | LS10 exists = 1    Ok
                  2016-02-16 13:08:49    142282    EXEC    5502    iTunes RM | A19 | LS10 output =    Ok
                  Danke und LG, Dariusz
                  GIRA | ENERTEX | MDT | MEANWELL | 24VDC LED | iBEMI | EDOMI | ETS5 | DS214+ | KNX/RS232-GW-ROTEL

                  Kommentar


                    Hallo zusammen,

                    was mache ich bitte falsch wenn der LBS mir die komplette Information anzeigt (Album, Titel, usw.) aber in der VISU etwas abgeschnitten wird (DPT16) ?

                    Bildschirmfoto 2016-02-27 um 15.10.03.png

                    Bildschirmfoto 2016-02-27 um 15.10.24.png
                    Danke und LG, Dariusz
                    GIRA | ENERTEX | MDT | MEANWELL | 24VDC LED | iBEMI | EDOMI | ETS5 | DS214+ | KNX/RS232-GW-ROTEL

                    Kommentar


                      evtl geht Text nur bis 14 Zeichen?
                      www.knx-Hausblog.de

                      Kommentar


                        Wenn's eine KNX-GA ist, sind in der Tat nur 14 Zeichen möglich. Ein internes KO kann seit 1.19 aber 10.000 Zeichen enthalten (zuvor: 200).
                        EDOMI - Intelligente Steuerung und Visualisierung KNX-basierter Elektro-Installationen (http://www.edomi.de)

                        Kommentar


                          OK, dann wird es ein Internes
                          Danke für den Hinweis !
                          Danke und LG, Dariusz
                          GIRA | ENERTEX | MDT | MEANWELL | 24VDC LED | iBEMI | EDOMI | ETS5 | DS214+ | KNX/RS232-GW-ROTEL

                          Kommentar


                            gaert Hallo Christian,

                            wenn ich anstatt eines UDP-Listener für den Empfang von Informationen die der LBS an die Ausgänge verteilt, eine JSON-Datei auslesen würde, kann/soll der Code im LBS-Teil platziert werden und das Auslesen der JSON würde dann über einen Oszi oder die Systemzeit (sekündlich) aktualisiert werden ?

                            $str = file_get_contents('http://10.0.100.150/%7Edariusz/track.json/');

                            Würde dann der Teil mit http-get dann auch in den LBS wandern können Und ich könnte mir den EXEC-Teil sparen ?

                            Jetzt ist es in etwas so gelöst (der LBS ist zu 99% fertig):
                            [schematisch]:

                            Socket …
                            while (Empfang)
                            UDP-Listener
                            $len = socket_recv($socket,$data,1024,MSG_DONTWAIT);
                            if ($len !== false) {
                            parse ….
                            else (kein Empfang)
                            HTTP

                            Ich versuche nur eine Variante des LBS zu bauen der die JSON lesen kann (EMPFANG) und weiterhin via HTTP (SENDEN) am Mac die Skripte startet ...

                            Danke für die Nachsicht vorab
                            Danke und LG, Dariusz
                            GIRA | ENERTEX | MDT | MEANWELL | 24VDC LED | iBEMI | EDOMI | ETS5 | DS214+ | KNX/RS232-GW-ROTEL

                            Kommentar


                              Der erste Selbstversuch ist zumindest nicht negativ …
                              Es scheint zu funktionieren ABER …
                              Der CPU geht von ursprünglich ca. 8% auf 80-90% dauerhaft :-(

                              Was mache ich falsch ?

                              PHP-Code:
                              ###[HELP]###

                              ###[/HELP]###



                              ###[DEF]###

                              [name = JSON]

                              [e#1  =  autostart #init=1]
                              [e#2  = ]
                              [e#3  = ]
                              [e#4  = ]
                              [e#5  = ]

                              [a#1  = name]
                              [a#2  = album]
                              [a#3  = genere]
                              [a#4  = composer]
                              [a#5  = artist]

                              ###[/DEF]###



                              ###[LBS]###

                              <?php

                              function LB_LBSID($id) {

                                  if (
                              $E=getLogicEingangDataAll($id)) {
                                      if (
                              getLogicElementStatus($id)==0) {
                                          
                              setLogicElementStatus($id,1);
                                      }
                                  
                                          
                              $str file_get_contents('http://10.0.100.150/%7Edariusz/track.json');
                                          
                              $json json_decode($strtrue);
                                          
                                          
                              setLogicLinkAusgang($id,1,$json['name']);
                                          
                              setLogicLinkAusgang($id,2,$json['album']);
                                          
                              setLogicLinkAusgang($id,3,$json['genre']);
                                          
                              setLogicLinkAusgang($id,4,$json['composer']);
                                          
                              setLogicLinkAusgang($id,5,$json['artist']);
                                  }
                              }

                              ?>

                              ###[/LBS]###


                              ###[EXEC]###

                              <?php

                              ?>

                              ###[/EXEC]###


                              Bildschirmfoto 2016-03-03 um 20.41.35.png
                              Danke und LG, Dariusz
                              GIRA | ENERTEX | MDT | MEANWELL | 24VDC LED | iBEMI | EDOMI | ETS5 | DS214+ | KNX/RS232-GW-ROTEL

                              Kommentar


                                Zitat von coliflower Beitrag anzeigen
                                Was mache ich falsch ?
                                Der json (HTTP-)Request sollte in den EXEC Teil... weiter hab ich jetzt nicht mehr gelesen

                                Kommentar

                                Lädt...
                                X