Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Win32::GUI();
- sub makeTSSN {
- $id[0]=int(rand(8))+1;
- $last=$id[0];
- foreach $z (2..12) {
- $id[$z-1]=int(rand(9));
- $tmp[$z-1]=$id[$z-1]*(14-$z);
- $last+=$tmp[$z-1];
- }
- $last=11-($last%11);
- if ($last==11) {
- $last=1;
- }
- elsif ($last==10) {
- $last=0;
- }
- $key=join('',@id);
- $key.=$last;
- #return $key;
- return "$id[0]-$id[1]$id[2]$id[3]$id[4]-$id[5]$id[6]$id[7]$id[8]$id[9]-$id[10]$id[11]-$last";
- }
- $main=Win32::GUI::Window->new(
- -name => 'Main',
- -width => 350,
- -height => 200,
- -title => "TSSN By AssazziN : 24.11.2010",
- );
- $main->AddLabel(
- -name => "Text",
- -left => 100,
- -top => 20,
- -width => 150,
- -height => 20,
- -text => "Thai ID Gen : AssazziN",
- );
- $main->AddTextfield(
- -name => "TextField",
- -left => 70,
- -top => 60,
- -width => 200,
- -height => 25,
- -prompt => "ID Gen : ",
- -text => &makeTSSN,
- );
- $main->AddButton(
- -name => 'Button',
- -text => 'Ok',
- -default => 1,
- -ok => 1,
- -width => 60,
- -height => 20,
- -left => $main->ScaleWidth() - 200,
- -top => $main->ScaleHeight() - 50,
- );
- $main->Show();
- Win32::GUI::Dialog();
- exit(0);
- sub Main_Terminate {
- return -1;
- }
- sub Button_Click {
- #$main->AddLabel(
- #-text => &makeTSSN,
- #);
- $main->TextField->Text(&makeTSSN);
- print &makeTSSN,"\n";
- return 0;
- }
- #http://comfreedom.blogspot.com
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement