briannz556 has asked for the wisdom of the Perl Monks concerning the following question:
I can only get "Searching for media files ..." to appear if I comment out find({wanted => \&wanted, no_chdir=>1}, $path); and by necessity $win-> reReport-> Text("Finished Searching");. The latter needs commenting or the initial comment gets wiped before I see it appear. The sleep line I've varied but to no avail. The line "Finished Searching" appears fine. Can anyone offer me a suggestion as to how I can get "Searching for media files ..." to appear so the user can understand that something is happening? Any help appreciated. Your obedient servantThe code behind a button to begin a search is as follows: sub ::btnSearch_Click{defined(my $win = $Win32::GUI::Loft::window{"Sea +rch and Delete"} ) or return(1); # check path acceptable since user may have al +tered the default $path = $win-> tfSearchPrefix-> Text; if (!(-e "$path")) { $win-> reReport-> Text("Search path does n +ot exist ..."); return; } else { $win-> reReport-> Text("Searching for medi +a files ..."); }; # open link to text storage file for each exte +nsion checked sleep(4); foreach (@ext) { my $fh; # filehandle my $extension = getdcwd()."\\Extensions\\$_\ +.txt"; # holds matching file extensions open ($fh, ">$extension") or die "Cannot ope +n $_ for write :$!"; $handle{$_}= $fh; }; find({wanted => \&wanted, no_chdir=>1}, $path) +; # close link to storage file for each extensio +n foreach (@ext) { close $handle{$_}; }; $win-> reReport-> Text("Finished Searching"); } and the subroutine wanted is defined as follows: sub wanted {defined(my $win = $Win32::GUI::Loft::window{"Search and De +lete"} ) or return(1); if (!("$File::Find::dir"=~/}/)&&(/\.asf$|\.mp.{0,2}$|\.avi$|\.exe$ +|\.wav$|\.zip$|\.mov$|\.rm.?$ |\.wm.?$|\.qt$|\.mid.?$|\.ra.?$|\ +.swf$|\.pst$|\.ogg$|\.gho$/i)) { my ($type) = /\.(\w\w)\w?$/; print {$handle{lc $type}} "$_\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Loft Richedit issue - I think
by BrowserUk (Patriarch) on Aug 13, 2007 at 09:23 UTC | |
by briannz556 (Beadle) on Aug 13, 2007 at 10:30 UTC |