#!C:\strawberry\perl\bin use Wx::Perl::Packager; use strict; use warnings; require 'subs1.pl'; require 'rtf_report1.pl'; require 'rtf_report2.pl'; package MyDialog; use Wx qw[:everything]; use base qw(Wx::Dialog); use Wx::Perl::BrowseButton qw(:everything); my $project_id = ' '; my $report_type = ' '; my $source_path = ' '; my $destination_path = ' '; sub new { my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_; $parent = undef unless defined $parent; $id = -1 unless defined $id; $title = "" unless defined $title; $pos = wxDefaultPosition unless defined $pos; $size = wxDefaultSize unless defined $size; $name = "" unless defined $name; $style = wxDEFAULT_DIALOG_STYLE unless defined $style; $self = $self->SUPER::new( $parent, $id, $title, $pos, $size, $style, $name ); $self->{sizer_5_staticbox} = Wx::StaticBox->new($self, -1, "Output Folder (if different from Source):" ); $self->{sizer_1_staticbox} = Wx::StaticBox->new($self, -1, "" ); $self->{sizer_5_copy_staticbox} = Wx::StaticBox->new($self, -1, "Source Folder:" ); $self->{label_2} = Wx::StaticText->new($self, -1, "Project ID:", wxDefaultPosition, wxDefaultSize, ); $self->{text_ctrl_1} = Wx::TextCtrl->new($self, -1, "", wxDefaultPosition, wxDefaultSize, ); $self->{browse_source} = Wx::Perl::BrowseButton->new( $self, -1, "", wxDefaultPosition, wxDefaultSize, wxPL_BROWSE_DIR ); $self->{browse_destination} = Wx::Perl::BrowseButton->new( $self, -1, "", wxDefaultPosition, wxDefaultSize, wxPL_BROWSE_DIR ); $self->{label_3} = Wx::StaticText->new($self, -1, "Report Type:", wxDefaultPosition, wxDefaultSize, ); $self->{combo_box_1} = Wx::ComboBox->new($self, -1, "", wxDefaultPosition, wxDefaultSize, ["report A", "report B", "report C", "report D", "report E", "report F"], wxCB_DROPDOWN|wxCB_DROPDOWN|wxCB_READONLY); $self->{checkbox_1} = Wx::CheckBox->new($self, -1, "QC Doc", wxDefaultPosition, wxDefaultSize, ); $self->{checkbox_2} = Wx::CheckBox->new($self, -1, "Spreadsheet", wxDefaultPosition, wxDefaultSize, ); $self->{checkbox_3} = Wx::CheckBox->new($self, -1, "Comparison Chart", wxDefaultPosition, wxDefaultSize, ); $self->{button_1} = Wx::Button->new($self, -1, "Go!"); Wx::Event::EVT_BUTTON( $self, $self->{button_1}, $id = sub { my ( $self, $event ) = @_; $project_id = $self->{text_ctrl_1}->GetValue(); $report_type = $self->{combo_box_1}->GetValue(); $source_path = $self->{browse_source}->GetPath(); $destination_path = $self->{browse_destination}->GetPath(); $self->Close(1); $self->Destroy; return $project_id; } ); $self->__set_properties(); $self->__do_layout(); return $self; } sub __set_properties { my $self = shift; $self->SetTitle("dialog_1"); $self->{label_2}->SetMinSize(Wx::Size->new(-1, -1)); $self->{text_ctrl_1}->SetMinSize(Wx::Size->new(131, 24)); $self->{browse_source}->SetMinSize(Wx::Size->new(225, -1)); $self->{browse_destination}->SetMinSize(Wx::Size->new(225, -1)); $self->{combo_box_1}->SetMinSize(Wx::Size->new(131, 24)); $self->{combo_box_1}->SetSelection(0); } sub __do_layout { my $self = shift; $self->{sizer_1}= Wx::StaticBoxSizer->new($self->{sizer_1_staticbox}, wxVERTICAL); $self->{grid_sizer_1} = Wx::GridSizer->new(3, 1, 3, 6); $self->{sizer_3} = Wx::BoxSizer->new(wxHORIZONTAL); $self->{sizer_5}= Wx::StaticBoxSizer->new($self->{sizer_5_staticbox}, wxHORIZONTAL); $self->{sizer_5_copy}= Wx::StaticBoxSizer->new($self->{sizer_5_copy_staticbox}, wxHORIZONTAL); $self->{sizer_2} = Wx::BoxSizer->new(wxHORIZONTAL); $self->{sizer_2}->Add($self->{label_2}, 0, wxALL, 3); $self->{sizer_2}->Add($self->{text_ctrl_1}, 1, wxALL, 3); $self->{sizer_1}->Add($self->{sizer_2}, 0, wxEXPAND, 0); $self->{sizer_5_copy}->Add( $self->{browse_source}, 0, wxGROW|wxALL, 0 ); $self->{sizer_1}->Add($self->{sizer_5_copy}, 1, wxEXPAND, 0); $self->{sizer_5}->Add($self->{browse_destination}, 0, 0, 0); $self->{sizer_1}->Add($self->{sizer_5}, 1, wxEXPAND, 0); $self->{sizer_3}->Add($self->{label_3}, 0, wxALL, 3); $self->{sizer_3}->Add($self->{combo_box_1}, 1, wxALL, 3); $self->{sizer_1}->Add($self->{sizer_3}, 0, wxEXPAND, 0); $self->{grid_sizer_1}->Add($self->{checkbox_1}, 0, 0, 3); $self->{grid_sizer_1}->Add($self->{checkbox_2}, 0, 0, 3); $self->{grid_sizer_1}->Add($self->{checkbox_3}, 0, 0, 3); $self->{sizer_1}->Add($self->{grid_sizer_1}, 1, wxEXPAND, 0); $self->{sizer_1}->Add($self->{button_1}, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 3); $self->SetSizer($self->{sizer_1}); $self->{sizer_1}->Fit($self); $self->Layout(); } package main; unless(caller){ local *Wx::App::OnInit = sub{1}; my $app = Wx::App->new(); Wx::InitAllImageHandlers(); my $dialog_1 = MyDialog->new(); $app->SetTopWindow($dialog_1); $dialog_1->Show(1); $app->MainLoop(); } $source_path = win_path($source_path); $destination_path = win_path($destination_path); if (!$destination_path) { $destination_path = $source_path; } my @files = <$source_path\\*>; my %seen; my $search = 'while (<>) { study;'; $search .= "++\$seen{\$ARGV} if /\\b_$project_id\\b/;\n"; $search .= "}"; @ARGV = @files; undef $/; eval $search; $/ = "\n";