Ask a Question related to PERL Beginners, Design and Development.
-
Harry Putnam #1
Control a non-perl image viewer from perl script
Below is a (non-finished) script that trys to run a linux viewer
called eog (eye of gnome) in a script that will eventually allow me to
power thru long lists of image files and rename them as I go.
The idea was a cmdline tool that would pop up a view of each image
then query user for new name. Kill that process and move on to next
item in list.
I couldn't think of any better way than to query `ps' for the pid and
run `kill' on it. However even that isn't working.
But I wondered if there is a better way of doing this that is still
fairly basic?
#!/usr/local/bin/perl -w
$question = "New name please => ";
$ext=shift;
$ls_proc = "ls *.$ext";
open(LS_PROC," $ls_proc|");
while(<LS_PROC>){
chomp;
push @ls_array,$_;
}
for(@ls_array){
$pic = $_;
system("eog $pic &");
print $question;
chomp ($newname = <STDIN>);
print "<$newname>\n";
qx(cp -a $pic "$newname.$ext");
## rename $_ "$newname.$ext";
open(PS_PROC,"ps wwaux|");
while(<PS_PROC>){
chomp;
if($_ =~ /^$ENV{LOGNAME}.*eog.*\.jpg$/){
my $line = $_;
print "hpdb \$line = $line\n";
<STDIN>;
$pid = (split(/\s+/,$line))[1];
print "hpdb \$pid = $pid\n";
<STDIN>;
print "kill -15 on $pid?\n";
$ans = <STDIN>;
if ($ans eq "y"){
print "Killing -15 on pid <$pid>\n";
qx(kill -15 $pid);
}
}
}
close(PS_PROC);
}
close(LS_PROC);
Harry Putnam Guest
-
Image Viewer Control
Hello All, Could anybody please give me ideas on building a Image viewer control regards, Kuldeep -
RFC on first perl script
Hi all well im trying at lerning this perl stuff.. reading from the "learning perl" oreilly book and a few other places, but also using perl a... -
ASP --> PERL SCRIPT
try using $ENV{THIS_SCRIPT} -
ASP --> PERL SCRIPT HELP>>PLEASE>>
Hello..I was browsing thru the newsgroups ...and was wondering if anyone here can be of assistance to me....as I am very very new to PERL..and have... -
Execute shell script from a perl script
Hi, How can I executed a Unix shell script from a Perl script. The shell script is a dump of a oracle table to a file. The perl script is for... -
Harry Putnam #2
Re: Control a non-perl image viewer from perl script
zentara <zentara@highstream.net> writes:
Many thanks, the code is right on the mark and the app you mentioned,> You could also check out: [url]http://herrmanns-stern.de/[/url]
> for a couple of image viewer utilities written in perltk.
>
> Here is some code which will give you a good outline for
> forking and execing which will let you kill the stored pid.
> Working your image viewer in should be pretty simple.
well it looks like Martin H. wanted to do the same thing I did and
lots more... only he knew how to do something about it..
Thanks
Harry Putnam Guest



Reply With Quote

