rostiEvntl. stehen Datumsangaben in der PDF wenn es die PDF-Sprzifikation hergibt.
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
#!/usr/bin/perl use warnings; use strict; use Tk; package MyButton { sub new { my $classname = shift; my $self = {nr => shift}; return bless($self, $classname); } sub createButton { my $self = shift; my $main = shift; my $frame = shift; $self->{button} = $frame->Button(-text => $self->{nr}, -command => sub { $main->btnClick($self->{nr}) }); $self->{button}->pack(-side => "left", -pady => 5); } } package MyWindow { sub new { my $classname = shift; my $self = {}; return bless($self, $classname); } sub createWindow { my $self = shift; $self->{mw} = MainWindow->new(-title => "pdfRename"); $self->{mw}->optionAdd("*font", "Arial 15 normal"); $self->{mw}->geometry("+400+256"); $self->{mw}->bind("<Control-q>" => sub { $self->{mw}->destroy()}); my ($i, $u, $mb, $frame); my $nr = 1; for $i (0 .. 3) { $frame = $self->{mw}->Frame(); for $u (0 .. 7) { if ($i == 3 && $u == 7) { next; } $mb = MyButton->new($nr); $mb->createButton($self, $frame); $nr++; } $frame->pack(); } $self->{mw}->MainLoop(); } sub btnClick { my $self = shift; my $nr = shift; my $a = $self->getPdfFilename(); print "$a\t\t$nr\n"; } sub getPdfFilename { my $self = shift; my $a = `ps x | grep pdf`; my @b = split(/\n/, $a); my $i; my @c; for $i (@b) { if ($i =~ /grep/) { next; } push(@c, $i); } if ($#c < 0) { print "\nWarning: No pdf-process found.\n"; return "None"; } $a = $c[0]; chomp($a); @b = split(/ /, $a); for $i (@b) { if ($i =~ /\.pdf/) { return $i; } } print "\nWarning: No pdf-filename found.\n"; return "None"; } } my $app = MyWindow->new(); $app->createWindow();