Sign in to follow this  
Followers 0
sak

Keys Generator Create

2 posts in this topic

#1 ·  Posted (edited)

For random 100 serials number.

#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Opt("MustDeclareVars", 1)

Global $Input_serials, $Button_gen, $Lbl_exit, $Lbl_copy
Global $nMsg, $i, $avArray, $copy, $avArray[1]
Global $Lbl_paste, $var, $text

GUICreate("Keygen Sample", 291, 115, -1, -1, -1, _
BitOR($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
$Input_serials = GUICtrlCreateInput("", 16, 40, 257, 21, _
BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_READONLY), _
BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetData(-1, "0000-0000-0000-0000")
$Button_gen = GUICtrlCreateButton("Gen", 104, 80, 75, 25, $WS_GROUP)
GUICtrlSetCursor (-1, 0)
GUICtrlSetTip(-1, "Random")
GUICtrlCreateLabel("Serials Random", 104, 16, 78, 17)
$Lbl_exit = GUICtrlCreateLabel("x", 274, 98, 18, 17, $SS_CENTER)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetCursor (-1, 0)
GUICtrlSetTip(-1, "Exit")
$Lbl_copy = GUICtrlCreateLabel("Copy", 40, 90, 50, 17, $SS_CENTER)
GUICtrlSetCursor (-1, 0)
GUICtrlSetTip(-1, "Copy to the clipboard")
$Lbl_paste = GUICtrlCreateLabel("Paste", 200, 90, 50, 17, $SS_CENTER)
GUICtrlSetCursor (-1, 0)
GUICtrlSetTip(-1, "Paste to the clipboard")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Lbl_exit
            ExitLoop
        Case $Button_gen
            _serialsrandom()
        Case $Lbl_copy
            $copy = GUICtrlRead($Input_serials)
            ClipPut($copy)
        Case $Lbl_paste
            If WinExists("[Class:Notepad]") Then WinClose("[Class:Notepad]")
            Run("Notepad")
            WinWaitActive("Keygen Sample", "", 1)
            $text = ControlGetText("Keygen Sample", "", "Edit1")
            WinWaitActive("[Class:Notepad]", "", 1)
            ControlSetText("[Class:Notepad]", "", "Edit1", $text)
    EndSwitch
WEnd

Func _serialsrandom()
For $i = 0 to UBound( $avArray ) - 1
    $avArray[$i] = Random( 0, 99, 1)
Next
 Select
    Case _ArrayToString($avArray, "|", 0, 99) = 0
        GUICtrlSetData($Input_serials, "00AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 1
        GUICtrlSetData($Input_serials, "0AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 2
        GUICtrlSetData($Input_serials, "0C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 3
        GUICtrlSetData($Input_serials, "0Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 4
        GUICtrlSetData($Input_serials, "0D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 5
        GUICtrlSetData($Input_serials, "0CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 6
        GUICtrlSetData($Input_serials, "00AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 7
        GUICtrlSetData($Input_serials, "0UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 8
        GUICtrlSetData($Input_serials, "0C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 9
        GUICtrlSetData($Input_serials, "0T67-4GH4-515K-6U86")
    Case _ArrayToString($avArray, "|", 0, 99) = 10
        GUICtrlSetData($Input_serials, "10AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 11
        GUICtrlSetData($Input_serials, "1AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 12
        GUICtrlSetData($Input_serials, "1C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 13
        GUICtrlSetData($Input_serials, "1Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 14
        GUICtrlSetData($Input_serials, "1D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 15
        GUICtrlSetData($Input_serials, "1CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 16
        GUICtrlSetData($Input_serials, "10AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 17
        GUICtrlSetData($Input_serials, "1UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 18
        GUICtrlSetData($Input_serials, "1C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 19
        GUICtrlSetData($Input_serials, "1T67-4GH4-515K-6U86")
    Case _ArrayToString($avArray, "|", 0, 99) = 20
        GUICtrlSetData($Input_serials, "20AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 21
        GUICtrlSetData($Input_serials, "2AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 22
        GUICtrlSetData($Input_serials, "2C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 23
        GUICtrlSetData($Input_serials, "2Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 24
        GUICtrlSetData($Input_serials, "2D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 25
        GUICtrlSetData($Input_serials, "2CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 26
        GUICtrlSetData($Input_serials, "20AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 27
        GUICtrlSetData($Input_serials, "2UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 28
        GUICtrlSetData($Input_serials, "2C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 29
        GUICtrlSetData($Input_serials, "2T67-4GH4-515K-6U86")
    Case _ArrayToString($avArray, "|", 0, 99) = 30
        GUICtrlSetData($Input_serials, "30AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 31
        GUICtrlSetData($Input_serials, "3AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 32
        GUICtrlSetData($Input_serials, "3C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 33
        GUICtrlSetData($Input_serials, "3Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 34
        GUICtrlSetData($Input_serials, "3D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 35
        GUICtrlSetData($Input_serials, "3CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 36
        GUICtrlSetData($Input_serials, "30AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 37
        GUICtrlSetData($Input_serials, "3UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 38
        GUICtrlSetData($Input_serials, "3C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 39
        GUICtrlSetData($Input_serials, "3T67-4GH4-515K-6U86")
    Case _ArrayToString($avArray, "|", 0, 99) = 40
        GUICtrlSetData($Input_serials, "40AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 41
        GUICtrlSetData($Input_serials, "4AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 42
        GUICtrlSetData($Input_serials, "4C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 43
        GUICtrlSetData($Input_serials, "4Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 44
        GUICtrlSetData($Input_serials, "4D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 45
        GUICtrlSetData($Input_serials, "4CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 46
        GUICtrlSetData($Input_serials, "40AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 47
        GUICtrlSetData($Input_serials, "4UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 48
        GUICtrlSetData($Input_serials, "4C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 49
        GUICtrlSetData($Input_serials, "4T67-4GH4-515K-6U86")
    Case _ArrayToString($avArray, "|", 0, 99) = 50
        GUICtrlSetData($Input_serials, "50AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 51
        GUICtrlSetData($Input_serials, "5AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 52
        GUICtrlSetData($Input_serials, "5C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 53
        GUICtrlSetData($Input_serials, "5Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 54
        GUICtrlSetData($Input_serials, "5D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 55
        GUICtrlSetData($Input_serials, "5CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 56
        GUICtrlSetData($Input_serials, "50AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 57
        GUICtrlSetData($Input_serials, "5UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 58
        GUICtrlSetData($Input_serials, "5C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 59
        GUICtrlSetData($Input_serials, "5T67-4GH4-515K-6U86")
    Case _ArrayToString($avArray, "|", 0, 99) = 60
        GUICtrlSetData($Input_serials, "60AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 61
        GUICtrlSetData($Input_serials, "6AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 62
        GUICtrlSetData($Input_serials, "6C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 63
        GUICtrlSetData($Input_serials, "6Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 64
        GUICtrlSetData($Input_serials, "6D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 65
        GUICtrlSetData($Input_serials, "6CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 66
        GUICtrlSetData($Input_serials, "60AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 67
        GUICtrlSetData($Input_serials, "6UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 68
        GUICtrlSetData($Input_serials, "6C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 69
        GUICtrlSetData($Input_serials, "6T67-4GH4-515K-6U86")
    Case _ArrayToString($avArray, "|", 0, 99) = 70
        GUICtrlSetData($Input_serials, "70AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 71
        GUICtrlSetData($Input_serials, "7AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 72
        GUICtrlSetData($Input_serials, "7C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 73
        GUICtrlSetData($Input_serials, "7Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 74
        GUICtrlSetData($Input_serials, "7D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 75
        GUICtrlSetData($Input_serials, "7CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 76
        GUICtrlSetData($Input_serials, "70AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 77
        GUICtrlSetData($Input_serials, "7UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 78
        GUICtrlSetData($Input_serials, "7C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 79
        GUICtrlSetData($Input_serials, "7T67-4GH4-515K-6U86")
    Case _ArrayToString($avArray, "|", 0, 99) = 80
        GUICtrlSetData($Input_serials, "80AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 81
        GUICtrlSetData($Input_serials, "8AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 82
        GUICtrlSetData($Input_serials, "8C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 83
        GUICtrlSetData($Input_serials, "8Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 84
        GUICtrlSetData($Input_serials, "8D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 85
        GUICtrlSetData($Input_serials, "8CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 86
        GUICtrlSetData($Input_serials, "80AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 87
        GUICtrlSetData($Input_serials, "8UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 88
        GUICtrlSetData($Input_serials, "8C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 89
        GUICtrlSetData($Input_serials, "8T67-4GH4-515K-6U86")
    Case _ArrayToString($avArray, "|", 0, 99) = 90
        GUICtrlSetData($Input_serials, "90AB-CD11-22EF-3GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 91
        GUICtrlSetData($Input_serials, "9AA1-22BB-CC33-4D4D")
    Case _ArrayToString($avArray, "|", 0, 99) = 92
        GUICtrlSetData($Input_serials, "9C22-3B3E-N44S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 93
        GUICtrlSetData($Input_serials, "9Tl3-4X44-555K-6R66")
    Case _ArrayToString($avArray, "|", 0, 99) = 94
        GUICtrlSetData($Input_serials, "9D44-55Y5-6IR6-ASD7")
    Case _ArrayToString($avArray, "|", 0, 99) = 95
        GUICtrlSetData($Input_serials, "9CVB-YUJ6-7UA7-8NE8")
    Case _ArrayToString($avArray, "|", 0, 99) = 96
        GUICtrlSetData($Input_serials, "90AB-CD11-225F-7GH3")
    Case _ArrayToString($avArray, "|", 0, 99) = 97
        GUICtrlSetData($Input_serials, "9UA1-22BB-CN33-4D4M")
    Case _ArrayToString($avArray, "|", 0, 99) = 98
        GUICtrlSetData($Input_serials, "9C62-3S3E-N4S4-55AD")
    Case _ArrayToString($avArray, "|", 0, 99) = 99
        GUICtrlSetData($Input_serials, "9T67-4GH4-515K-6U86")
 EndSelect
EndFunc

post-63570-0-14180500-1302202390_thumb.j

Edited by sak

Share this post


Link to post
Share on other sites



The _serialsrandom can be done shorten:

Func _SerialsRandom()
    Local $sStr = _StringGetRandomString(16, "ABCDEF1234567890")
    GUICtrlSetData($Input_serials, StringRegExpReplace($sStr, '([A-Z0-9]{4})(?=[A-Z0-9])', '\1-'))
EndFunc

Func _StringGetRandomString($iLen, $sABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    Local $iABC = StringLen($sABC), $sOut = ""
    Local $iBit = Int(Log($iABC) / Log(2))
    Local $iMsk = 2 ^ $iBit - 1
    Local $iChr = Int(31 / $iBit)
    Local $iRnd
    
    While 1
        $iRnd = Random(1, 0x7FFFFFFF, 1)
        
        For $i = 1 To $iChr
            $sOut &= StringMid($sABC, BitAND($iRnd, $iMsk), 1)
            If StringLen($sOut) >= $iLen Then Return $sOut
            $iRnd = BitShift($iRnd, $iBit)
        Next
    WEnd
EndFunc

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0