use strict; use warnings; use Tk; use Tk::ROText; use win32; use Win32::FileOp; use File::Find; use Tk::LabFrame; use Tk::LabEntry; my @filename; my $w; my $TagType; my $var; my $fileList; my $mw = new MainWindow; $mw -> setPalette('#EEEEEE'); $mw->resizable('no', 'no'); $mw -> title("get File List"); my $frame = $mw -> Frame -> pack (-side => 'top', -fill => 'both', -expand => 1, -padx => '12', -pady => '12'); my $frame1 = $frame -> Frame -> pack (-side => 'left'); $frame1 -> Button (-text => 'Add Files...', -command => \&openFile, -background => '#E9F0F7', -activebackground => '#B8C4E5') -> pack (-side => 'top', -padx => '0', -pady => '10', -anchor => 'e'); my $frame3a = $mw -> Frame () -> pack (-side => 'top', -fill => 'both', -expand => 1, -padx => 12, -pady => '6'); my $frame3 = $frame3a -> LabFrame (-label => "Add Files, and then arrange them in the order you want.", -font => 'Arial-Bold 11', -labelside => "acrosstop") -> pack (-anchor => 'w'); my $ins = $frame3 -> Scrolled("Listbox", -scrollbars => 'e', -width => '90', -background => 'white') -> pack(-side => 'top', -pady => '12', -padx => '12', -fill => 'both', -expand => 1); my $frame4 = $frame3 -> Frame () -> pack (-side => 'top', -fill => 'both', -expand => 1, -padx => '12'); my $frame5 = $frame4 -> Frame -> pack (-side => 'left'); my $frame6 = $frame4 -> Frame -> pack (-side => 'left'); $frame6 -> Button (-text => 'Move Up', -command => \&moveUP, -background => '#E9F0F7', -activebackground => '#B8C4E5', -width => '11') -> pack (-side => 'top', -padx => '6', -pady => '10', -anchor => 'w'); my $frame7 = $frame4 -> Frame -> pack (-side => 'left'); $frame7 -> Button (-text => 'Move Down', -command => \&moveDown, -background => '#E9F0F7', -activebackground => '#B8C4E5', -width => '11') -> pack (-side => 'top', -padx => '0', -pady => '10', -anchor => 'w'); my $frame8 = $frame4 -> Frame -> pack (-side => 'left'); $frame8 -> Button (-text => 'Remove', -command => \&removePages, -background => '#E9F0F7', -activebackground => '#B8C4E5', -width => '11') -> pack (-side => 'top', -padx => '6', -pady => '10', -anchor => 'w'); my $frame10 = $mw -> Frame -> pack (-side => 'bottom', -fill => 'both', -expand => 1, -padx => '12'); my $frame11 = $frame10 -> Frame -> pack (-side => 'right'); $frame11 -> Button (-text => 'Cancel', -command => sub{$mw -> destroy;}, -background => '#E9F0F7', -activebackground => '#B8C4E5', -width => '9') -> pack (-side => 'top', -pady => '10', -anchor => 'ne'); my $frame12 = $frame10 -> Frame -> pack (-side => 'right'); $frame12 -> Button (-text => 'Process', -command => \&process, -background => '#E9F0F7', -activebackground => '#B8C4E5', -width => '9') -> pack (-side => 'top', -padx => '0', -padx => '6', -pady => '10', -anchor => 'ne'); MainLoop; sub openFile { my @types = ( [ "3d Files", '.3d' ], [ "All files", '*' ] ); @filename = $mw->getOpenFile( -filetypes => \@types, -defaultextension => '.3d', -title => 'file to read', -multiple => 1, ); $mw->Unbusy; return 'Cancel' unless (@filename); foreach my $single(@filename) { $ins->insert( 'end', "$single" ); } } sub gotoSave { my $ExtractedStream = $w->get("1.0", "end"); print "$ExtractedStream"; } sub gotoClear { $ins -> delete ("1.0", "end"); } sub moveUP { my @fileList = $ins->curselection(); my $selIndex = $fileList[0]; $selIndex = $selIndex-1; $fileList = $ins->get(@fileList); $ins->delete(@fileList); $ins -> insert($selIndex, $fileList); $ins->selectionSet($selIndex); } sub moveDown { my @fileList = $ins->curselection(); my $selIndex = $fileList[0]; $selIndex = $selIndex+1; $fileList = $ins->get(@fileList); $ins->delete(@fileList); $ins -> insert($selIndex, $fileList); $ins->selectionSet($selIndex); } sub removePages { my @fileList = $ins->curselection(); $ins->delete(@fileList); } sub process { my @colList = $ins -> get(0, 'end'); my $count = 1; foreach my $single(@colList) { print "$count\. $single\n"; $count++; } }