Thread Textdatei mit externem Editor öffnen (16 answers)
Opened by Gast at 2007-11-22 13:57

Gast Gast
 2007-11-26 16:27
#103057 #103057
So, hier mal die relevanten Teile, falls du sonst noch was brauchst, einfach melden.
Danke schonmal, dass du dir die Zeit nimmst :)

Code (perl): (dl )
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
#!/usr/bin/perl
use Tk;
use threads;

my @packetnumber;
my @hostname;
my %pack_status;


my $mw = new MainWindow();
my $mframe = $mw->Frame();
my $textfield_listing = $mframe->ScrlListbox(-scrollbars =>"se");
my $button_log = $mframe->Button(-command=>\&viewLog);

sub viewLog() {
        if ($textfield_listing->curselection()) {
                
                # make a new Thread for the editor-application
                my $editor = threads->create("openLogWEA");
        }
}

sub openLogWEA() {
        
        # get logfile-location
        my @tempvar = $textfield_listing->curselection();
        my $pos = $tempvar[0];
        my $location = "./Logfiles/Log_pack_$packetnumber[$pos].txt";
        
        system("kate $location");
}

View full thread Textdatei mit externem Editor öffnen