1 2 3 4 5 6 7
#!/usr/bin/perl use strict; use warnings; print "Eine Nachricht"; <STDIN>;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
#!C:\Perl\bin\perl ##=============== Fehlermeldungen/DEBUG ===============## use warnings; use strict; use diagnostics; ##=============== END ===============## ##=============== INI-Benötigte Befehle ===============## use Config::IniFiles; my $config = Config::IniFiles->new( -file => "tsreader.ini" ); my $port = $config->val("port", "tsport"); my $ip = $config->val("ip", "tsip"); ##=============== END ===============## ##=============== Variablen Declarieren ===============## my $t = ''; my $function = "Funktion:"; my $doit = ''; my $dont_send = ''; my $chart = ''; my $program_number = ''; my $multicast_address = ''; my $multicast_port = ''; my @line = ''; ##=============== END ===============## ##=============== Verbindung/Controll TSreader ===============## use Telnet (); ##=============== Connect to TSReader ===============## $t = new Net::Telnet (Timeout => 1, Port => $port); eval{$t->open($ip);}; ##=============== Display TSReader sent us===============## @line = $t->getline(); print "TSReader connected.\nResponse: @line\n"; ##=============== Display functions ===============## print "Functions supported are:\n"; print " 1 - print programs in mux\n"; print " 2 - display graph\n"; print " 3 - switch to a multicast UDP mux\n"; print " 4 - play channel via VLC\n"; print " 5 - export to HTML\n"; print " 6 - show info\n"; print "Function? "; $function = <STDIN>; chop $function; if ($function eq 1) { #Get and print a list of programs $t->print("PROGRAM"); print "These programs are defined:\n"; $doit = 1; while($doit eq 1) { eval {@line = $t->getline(Timeout => 1);}; if ($@) {$doit=0;} else {print @line;} } } elsif ($function eq 2) { #Draw a graph $dont_send = 0; print "Available graphs are:\n"; print " 0 - close any existing graph\n"; print " 1 - Active PIDs by rate\n"; print " 2 - Active PIDs by PID\n"; print " 3 - PID usage 2D pie\n"; print " 4 - PID usage 3D pie\n"; print " 5 - Mux usage stacked area\n"; print " 6 - Mux usage line\n"; print " 7 - Video rate area\n"; print " 8 - Video rate line\n"; print " 9 - Program usage\n"; print " 10 - Video composition\n"; print "Which chart? "; $chart = <STDIN>; chop $chart; if ($chart eq 10) { print "Program number? "; $program_number = <STDIN>; chop $program_number; $t->print("PROGRAM $program_number"); @line = $t->getline(Timeout => 1); if (@line ="~ /502/") { print("?Invalid program number!\n"); $dont_send = 1; } } if ($dont_send eq 0) { $t->print("GRAPH $chart"); @line = $t->getline(Timeout => 1); } } elsif ($function eq 3) { #Switch to the multicast source and restart TSReader print "Multicast address to listen to? "; $multicast_address = <STDIN>; chop $multicast_address; print "UDP port to listen to? "; $multicast_port = <STDIN>; chop $multicast_port; $t->print("SOURCE TSReader_UDPMulticast.dll"); @line = $t->getline(Timeout => 1); print "Response to SOURCE: @line"; $t->print("TUNE $multicast_address $multicast_port"); @line = $t->getline(Timeout => 1); print "Response to TUNE: line"; } elsif ($function eq 4) { $dont_send = 0; print "Program number? "; $program_number = <STDIN>; chop $program_number; $t->print("PROGRAM $program_number"); @line = $t->getline(Timeout => 1); if (@line ="~ /502/") { print("?Invalid program number!\n"); $dont_send = 1; } if ($dont_send eq 0) { $t->print("PLAY VLC1"); @line = $t->getline(Timeout => 1); print "Response to PLAY: @line"; } elsif ($function eq 5) { $dont_send = 0; $t->print("EXPORT"); } elsif ($function eq 6) { $dont_send = 0; $t->print("INFO"); @line = $t->getline(Timeout => 1); print "INFO"; } } #all done $t->print("quit");
2011-08-03T08:39:29 FIFOedit: renees Variante scheitert, wenn Du das Perlskript per Doppelklick aufrufst und es wegen einem fatalen Fehler "stirbt"
Quote
QuoteNur, wenn das programm mit die oder exit beendet wird.Hab aber immernoch das problem, das bei fehlermeldungen einfach die dosbox verschwindet.
Quotegibt es nicht denn befehel iwie das die dosbox nur bei "exit" beenden soll und sonst NIEMALS ??
2011-08-03T10:45:50 the0MIKEIch möchte auch keine batch datei ausführen, weil wir gerade deswegen auf des programm umsteigen wollen (im moment läuft eine bat datei)
gibt es nicht denn befehel iwie das die dosbox nur bei "exit" beenden soll und sonst NIEMALS ??
2011-08-03T12:57:10 the0MIKEach könnte ich eine GUI mit perl bauen?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
#!C:\Perl\bin\perl ##=============== Fehlermeldungen/DEBUG ===============## #use warnings; #use strict; #use diagnostics; ##=============== END ===============## ##=============== INI-Benötigte Befehle ===============## use Config::IniFiles; my $config = Config::IniFiles->new( -file => "tsreader.ini" ); my $port = $config->val("port", "tsport"); my $ip = $config->val("ip", "tsip"); my $pfad1 = $config->val("pfad", "phtml1"); my $pfad2 = $config->val("pfad", "phtml2"); my $freq1 = $config->val("frequenz", "freq1"); my $freq2 = $config->val("frequenz", "freq2"); ##=============== END ===============## ##=============== Variablen Declarieren ===============## my $t = ''; my $function = "Funktion:"; my $doit = ''; my $dont_send = ''; my $chart = ''; my $program_number = ''; my $multicast_address = ''; my $multicast_port = ''; my @line = ''; ##=============== END ===============## ##=============== Verbindung/Controll TSreader ===============## use Telnet (); ##=============== Connect to TSReader ===============## $t = new Net::Telnet (Timeout => 1, Port => $port); eval{$t->open($ip);}; my $x = 100; for (my $i=1; $i<$x;){ ##=============== Display TSReader sent us===============## @line = $t->getline(); print "TSReader connected.\nResponse: @line\n"; ##=============== Display functions ===============## print "Functions supported are:\n"; print " 1 - print programs in mux\n"; print " 2 - display graph\n"; print " 3 - switch to a multicast UDP mux\n"; print " 4 - play channel via VLC\n"; print " 5 - export to HTML\n"; print " 6 - Exit\n"; print "Function? "; $function = <STDIN>; chomp $function; if ($function eq 1) { #Get and print a list of programs $t->print("PROGRAM"); print "These programs are defined:\n"; $doit = 1; while($doit eq 1) { eval {@line = $t->getline(Timeout => 1);}; if ($@) {$doit=0;} else {print @line;} } } elsif ($function eq 2) { #Draw a graph $dont_send = 0; print "Available graphs are:\n"; print " 0 - close any existing graph\n"; print " 1 - Active PIDs by rate\n"; print " 2 - Active PIDs by PID\n"; print " 3 - PID usage 2D pie\n"; print " 4 - PID usage 3D pie\n"; print " 5 - Mux usage stacked area\n"; print " 6 - Mux usage line\n"; print " 7 - Video rate area\n"; print " 8 - Video rate line\n"; print " 9 - Program usage\n"; print " 10 - Video composition\n"; print "Which chart? "; $chart = <STDIN>; chomp $chart; if ($chart eq 10) { print "Program number? "; $program_number = <STDIN>; chop $program_number; $t->print("PROGRAM $program_number"); @line = $t->getline(Timeout => 1); if (@line ="~ /502/") { print("?Invalid program number!\n"); $dont_send = 1; } } if ($dont_send eq 0) { $t->print("GRAPH $chart"); @line = $t->getline(Timeout => 1); } } elsif ($function eq 3) { #Switch to the multicast source and restart TSReader print "Multicast address to listen to? "; $multicast_address = <STDIN>; chomp $multicast_address; print "UDP port to listen to? "; $multicast_port = <STDIN>; chomp $multicast_port; $t->print("SOURCE TSReader_UDPMulticast.dll"); @line = $t->getline(Timeout => 1); print "Response to SOURCE: @line"; $t->print("TUNE $multicast_address $multicast_port"); @line = $t->getline(Timeout => 1); print "Response to TUNE: line"; } elsif ($function eq 4) { $dont_send = 0; print "Program number? "; $program_number = <STDIN>; chomp $program_number; $t->print("PROGRAM $program_number"); @line = $t->getline(Timeout => 1); if (@line ="~ /502/") { print("?Invalid program number!\n"); $dont_send = 1; } if ($dont_send eq 0) { $t->print("PLAY VLC1"); @line = $t->getline(Timeout => 1); print "Response to PLAY: @line"; } } elsif ($function eq 5) { $dont_send = 0; $t->print("TUNE $freq1"); print "Changed Tuner 1\n"; sleep(10); $t->print("EXPORT HTML $pfad1"); sleep (3); $dont_send = 0; $t->print("TUNE $freq2"); print "Changed Tuner2\n"; sleep (10); $t->print("EXPORT HTML $pfad2"); print "HTML-Seiten wurde erfolgreich Exportiert\n\n"; } } #all done $dont_send = 0; print "Beenden"; $function = <STDIN>; if ($function eq 6) { $t->print(''); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
#!C:\Perl\bin\perl ##=============== Fehlermeldungen/DEBUG ===============## use warnings; use strict; use diagnostics; ##=============== END ===============## ##=============== INI-Benötigte Befehle ===============## use Config::IniFiles; my $config = Config::IniFiles->new( -file => "tsreader.ini" ); my $port = $config->val( "port", "tsport" ); my $ip = $config->val( "ip", "tsip" ); my $pfad1 = $config->val( "pfad", "phtml1" ); my $pfad2 = $config->val( "pfad", "phtml2" ); my $freq1 = $config->val( "frequenz", "freq1" ); my $freq2 = $config->val( "frequenz", "freq2" ); ##=============== END ===============## ##=============== Variablen Declarieren ===============## my $t = ''; my $function = "Funktion:"; my $doit = ''; my $dont_send = ''; my $chart = ''; my $program_number = ''; my $multicast_address = ''; my $multicast_port = ''; my @line = ''; ##=============== END ===============## ##=============== Verbindung/Controll TSreader ===============## use Telnet (); ##=============== Connect to TSReader ===============## $t = new Net::Telnet( Timeout => 1, Port => $port ); eval { $t->open($ip); }; if($@){ # error handling.... } my $x = 100; for ( my $i = 1 ; $i < $x ; ) { ##=============== Display TSReader sent us===============## @line = $t->getline(); print "TSReader connected.\nResponse: @line\n"; ##=============== Display functions ===============## print "Functions supported are:\n"; print " 1 - print programs in mux\n"; print " 2 - display graph\n"; print " 3 - switch to a multicast UDP mux\n"; print " 4 - play channel via VLC\n"; print " 5 - export to HTML\n"; print " 6 - Exit\n"; print "Function? "; $function = <STDIN>; chomp $function; if ( $function == 1 ) { #Get and print a list of programs $t->print("PROGRAM"); print "These programs are defined:\n"; $doit = 1; while ( $doit eq 1 ) { eval { @line = $t->getline( Timeout => 1 ); }; if ($@) { $doit = 0; } else { print @line; } } } elsif ( $function == 2 ) { #Draw a graph $dont_send = 0; print "Available graphs are:\n"; print " 0 - close any existing graph\n"; print " 1 - Active PIDs by rate\n"; print " 2 - Active PIDs by PID\n"; print " 3 - PID usage 2D pie\n"; print " 4 - PID usage 3D pie\n"; print " 5 - Mux usage stacked area\n"; print " 6 - Mux usage line\n"; print " 7 - Video rate area\n"; print " 8 - Video rate line\n"; print " 9 - Program usage\n"; print " 10 - Video composition\n"; print "Which chart? "; $chart = <STDIN>; chomp $chart; if ( $chart == 10 ) { print "Program number? "; $program_number = <STDIN>; chop $program_number; $t->print("PROGRAM $program_number"); @line = $t->getline( Timeout => 1 ); if ( @line = "~ /502/" ) { print("?Invalid program number!\n"); $dont_send = 1; } } if ( $dont_send == 0 ) { $t->print("GRAPH $chart"); @line = $t->getline( Timeout => 1 ); } } elsif ( $function == 3 ) { #Switch to the multicast source and restart TSReader print "Multicast address to listen to? "; $multicast_address = <STDIN>; chomp $multicast_address; print "UDP port to listen to? "; $multicast_port = <STDIN>; chomp $multicast_port; $t->print("SOURCE TSReader_UDPMulticast.dll"); @line = $t->getline( Timeout => 1 ); print "Response to SOURCE: @line"; $t->print("TUNE $multicast_address $multicast_port"); @line = $t->getline( Timeout => 1 ); print "Response to TUNE: line"; } elsif ( $function == 4 ) { $dont_send = 0; print "Program number? "; $program_number = <STDIN>; chomp $program_number; $t->print("PROGRAM $program_number"); @line = $t->getline( Timeout => 1 ); if ( @line = "~ /502/" ) { print("?Invalid program number!\n"); $dont_send = 1; } if ( $dont_send eq 0 ) { $t->print("PLAY VLC1"); @line = $t->getline( Timeout => 1 ); print "Response to PLAY: @line"; } } elsif ( $function == 5 ) { $dont_send = 0; $t->print("TUNE $freq1"); print "Changed Tuner 1\n"; sleep(10); $t->print("EXPORT HTML $pfad1"); sleep(3); $dont_send = 0; $t->print("TUNE $freq2"); print "Changed Tuner2\n"; sleep(10); $t->print("EXPORT HTML $pfad2"); print "HTML-Seiten wurde erfolgreich Exportiert\n\n"; } } #all done $dont_send = 0; print "Beenden"; $function = <STDIN>; if ( $function == 6 ) { $t->print(''); }
if($foo eq "bar"){
if ( @line = "~ /502/" ) {
if(1){
2011-08-03T17:40:27 kristianEDIT2: Wer erklärt mir denn diese Zeile?
Code (perl): (dl )if ( @line = "~ /502/" ) {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
#!C:\Perl\bin\perl ##=============== Fehlermeldungen/DEBUG ===============## #use warnings; #use strict; #use diagnostics; ##=============== END ===============## ##=============== Variablen Declarieren ===============## my $t = ''; my $function = "Funktion:"; my $doit = ''; my $dont_send = ''; my $chart = ''; my $program_number = ''; my $multicast_address = ''; my $multicast_port = ''; my @line = ''; ##=============== END ===============## my $x = 1; for (my $i=0; $i<$x;) { ##=============== INI-Benötigte Befehle ===============## use Config::IniFiles; my $config = Config::IniFiles->new( -file => "tsreader.ini" ); my $port = $config->val("port", "tsport"); my $ip = $config->val("ip", "tsip"); my $pfad1 = $config->val("pfad", "phtml1"); my $pfad2 = $config->val("pfad", "phtml2"); my $freq1 = $config->val("frequenz", "freq1"); my $freq2 = $config->val("frequenz", "freq2"); my $time = $config->val("time", "timer"); ##=============== END ===============## ##=============== Connect to TSReader ===============## use Telnet (); $t = new Net::Telnet (Timeout => 1, Port => $port); eval{$t->open($ip);}; if ($@) { print "#############################################################################################################\n"; print "Unable to connect to TSReader - is the control server running?\n$@\n"; print "#############################################################################################################\ns"; $dont_send = 0; my $z = true; print "Beenden"; $function = <STDIN>; if ($z = true) { exit; } } else { @line = $t->getline(); print "\n#############################################################\n"; print "TSReader connected.\nResponse: @line"; print "#############################################################\n"; print "HMTL seite wird exportiert...\n\n"; ############# Automatischer Ablauf ############ $dont_send = 0; $t->print("TUNE $freq1"); print "Changed Tuner 1\n"; print "exportiert...\n"; sleep(20); $t->print("EXPORT HTML $pfad1"); $dont_send = 0; $t->print("TUNE $freq2"); print "Changed Tuner 2\n"; print "exportiert...\n"; sleep (20); $t->print("EXPORT HTML $pfad2"); system("cls"); ##=============== Uhrzeit - Deklarieren ===============## my ($Sekunden, $Minuten, $Stunden) = localtime(time); my $Stunden = $Stunden < 10 ? $Stunden = "0".$Stunden : $Stunden; my $Minuten = $Minuten < 10 ? $Minuten = "0".$Minuten : $Minuten; my $Sekunden = $Sekunden < 10 ? $Sekunden = "0".$Sekunden : $Sekunden; ##=============== END ===============## print "### HTML-Seiten wurde erfolgreich Exportiert um $Stunden.$Minuten:$Sekunden ###\n\n"; open(file, ">>log.txt"); print file "### HTML-Seiten wurde erfolgreich Exportiert um $Stunden.$Minuten:$Sekunden ###"; close(file); sleep($time);}}