最近麻雀で10連敗したり経費を踏み倒されてたりしてイライラしたので遊んでみた。
#!C:Perlinperl.exe
use strict;
use warnings;
use LWP::Useragent;
use HTTP::Request;
use Win32::GUI();
use Win32::Clipboard;
my $Clip = Win32::Clipboard();
# Create Window
my $Window = new Win32::GUI::Window(
-name => ’Window’,
-title => ’Sequentialer’,
-accel => my $acc,
-post => [400,300],
-size => [400,300],
);
# Add Label
my $Label_Version = $Window->AddLabel(
-name => ’Version’,
-text => ’ver 1.10’,
-align => ’left’,
-top => 5,
-left => 5,
-width => 50,
-height => 18,
);
my $Label_URL = $Window->AddLabel(
-name => ’Label_URL’,
-text => ’URL’,
-align => ’left’,
-top => 25,
-left => 5,
-width => 50,
-height => 18,
);
my $Label_Extension = $Window->AddLabel(
-name => ’Label Extension’,
-text => ’Extension’,
-align => ’left’,
-top => 45,
-left => 5,
-width => 50,
-height => 18,
);
my $Label_Header = $Window->AddLabel(
-name => ’Label Header’,
-text => ’Add 00’,
-align => ’left’,
-top => 44,
-left => 136,
-whdth => 50,
-height => 18,
);
my $Label_Fooder = $Window->AddLabel(
-name => ’Label Fooder’,
-text => ’Add 99’,
-align => ’left’,
-top => 44,
-left => 196,
-width => 50,
-height => 18,
);
my $Label_Hex = $Window->AddLabel(
-name => ’Label_Hex’,
-text => ’Hex(16)’,
-align => ’left’,
-top => 44,
-left => 256,
-height => 18,
);
my $Label_Result = $Window->AddLabel(
-name => ’Label_Reault’,
-text => ’Result’,
-align => ’left’,
-top => 63,
-left => 5,
-width => 50,
-height => 18,
);
my $Label_Proxy = $Window->AddLabel(
-name => ’Label_Proxy’,
-text => ’Proxy’,
-align => ’left’,
-top => 63,
-left => 135,
-width => 50,
-height => 18,
);
# Add Button
my $Button_Paste = $Window->AddButton(
-name => ’Button_Paste’,
-title => ’Paste’,
-top => 20,
-left => 323,
-width => 60,
-height => 18,
);
my $Button_Create = $Window->AddButton(
-name => ’Button_Create’,
-title => ’Create’,
-top => 40,
-left => 323,
-width => 60,
-height => 18,
);
my $Button_Copy = $Window->AddButton(
-name => ’Button_Copy’,
-title => ’Copy’,
-top => 60,
-left => 323,
-width => 60,
-height => 18,
);
# Add TextField
my $Textfield_URL = $Window->AddTextfield(
-name => ’TextfieldURL’,
-top => 21,
-left => 60,
-width => 240,
-height => 18,
-multiline => 0,
);
my $Textfield_Extension = $Window->AddTextfield(
-name => ’TextfieldExtension’,
-top => 41,
-left => 60,
-width => 50,
-height => 18,
-multiline => 0,
);
my $Textfield_Result = $Window->AddTextfield(
-name => ’Textfield_Result’,
-top => 80,
-left => 5,
-width => 380,
-height => 180,
-multiline => 1,
-vscroll => 1,
);
# AddCheckBox
my $CheckBox_Header = $Window->AddCheckbox(
-name => ’CheckBox_Header’,
-top => 42,
-left => 120,
-width => 15,
-height => 15,
-checked => 0,
);
my $CheckBox_Footer = $Window->AddCheckbox(
-name => ’CheckBox_Footer’,
-top => 42,
-left => 180,
-width => 15,
-height => 15,
-checked => 0,
);
my $CheckBox_Hex = $Window->AddCheckbox(
-name => ’CheckBox_Hex’,
-top => 42,
-left => 240,
-width => 15,
-height => 15,
-checked => 0,
);
my $CheckBox_Proxy = $Window->AddCheckbox(
-name => ’CheckBox_Proxy’,
-top => 62,
-left => 120,
-width => 15,
-height => 15,
-checked => 0,
);
&Message_Label(’’);
# Display Window
$Window->Show;
$Window->Dialog;
exit;
# Clipboard_Paste
sub Button_Paste_Click{
$Textfield_URL->Text($Clip->Get());
}
# Clipboard_Create
sub Button_Create_Click{
my $Temp_URL = $Textfield_URL->Text();
my $Temp_Extension = $Textfield_Extension->Text();
my $Temp_Header = $CheckBox_Header->GetCheck();
my $Temp_Footer= $CheckBox_Footer->GetCheck();
my $Temp_Hex = $CheckBox_Hex->GetCheck();
my ($Result,$Base);
if($Temp_URL){
my @URL = split(///,$Temp_URL);
if($Temp_Hex){
my($Number,$Extension) = split(/./,pop(@URL));
if(($Number)and($Extension)and($Number =~ m/_/)){
$Extension = $Temp_Extension if($Temp_Extension);
my($XNum,$YNum) = split(/_/,$Number);
if($XNum !~ m/[^0-9]/){
foreach(@URL){ $Base .= "$_/"; }
my $Cnt = 1 - $Temp_Header;
my $Nax = hex($YNum);
while(1){
my ($Num,$LNum,$HNum) = (’’,’’,’’);
for(my $ZCnt=0;$ZCntrequest($request);
if($res->is_success){
my $content = $res->content;
$outfile = &Replace($outfile);
open(FH, "> $directory$outfile");
binmode FH;
print FH "$content";
close(FH);
$filenum_ok++;
}else{
$filenum_ng++;
}
sleep($waittime);
&Message_Label(’’);
&Message_Label("Data acquiring ... $filenum_ok/$filenum_all");
}
&Message_Label(’’);
&Message_Label("Complete ! $filenum_ok/$filenum_all") if($filenum_ng == 0);
&Message_Label("Complete ! $filenum_ok/$filenum_all NG File $filenum_ng") if($filenum_ng != 0);
}
# Clipboard_Copy
sub Button_Copy_Click{
$Clip->Set($Textfield_Result->Text());
}
# Word replace for windows filename
sub Replace{
my $word = $_[0];
$word =~ s//¥/g;
$word =~ s/////g;
$word =~ s/*/*/g;
$word =~ s/:/:/g;
$word =~ s/?/?/g;
$word =~ s//>/g;
$word =~ s/"/”/g;
$word =~ s/|/|/g;
return($word);
}
# Create Message
sub Message_Label{
my $Message = $_[0];
$Message = ’ ’ unless($Message);
my $Label_Message = $Window->AddLabel(
-name => ’Message’,
-text => "$Message",
-align => ’left’,
-top => 5,
-left => 60,
-width => 200,
-height => 17,
);
$Window->Update();
}
コメント
しぽはん
ちゃーのみなはれ
頭がフラフラする > misaki