#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=..\woniu.ico
#AutoIt3Wrapper_outfile=编译成品\卡号生成器.exe
#AutoIt3Wrapper_Res_Comment=卡号生成器 猛牛脚本 HTTP://MENGNIU.IN QQ:114026307
#AutoIt3Wrapper_Res_Description=卡号生成器 猛牛脚本 HTTP://MENGNIU.IN
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=MENGNIU.IN 猛牛脚本
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Global $user_pre, $user_len, $user_num, $user_option[3]
Global $Checkbox_str[3]
Global $sysfile = @ScriptDir & "\mengniu.in"
Global $file_log
Global $string_rang[3][2] = [[48, 57],[97, 122],[65, 90]]
$user_pre = IniRead($sysfile, "设置", "前缀", "")
$user_len = IniRead($sysfile, "设置", "长度", 5)
$user_num = IniRead($sysfile, "设置", "数量", 10)
$checkit = 0
For $g_i = 0 To 2
$user_option[$g_i] = IniRead($sysfile, "设置", "选项" & $g_i, 0)
If $user_option[$g_i] == 1 Then $checkit = 1
Next
If $checkit == 0 Then $user_option[0] = 1
DirCreate("生成记录")
#Region ### START Koda GUI section ### Form=D:\程序\AUTOIT\SciTe\Koda\Forms\卡号生成.kxf
$Form1 = GUICreate("卡号生成器", 384, 201, 250, 435)
GUISetOnEvent($GUI_EVENT_CLOSE, "tuichu")
$Group1 = GUICtrlCreateGroup("点卡生成", 8, 8, 369, 169)
$Group2 = GUICtrlCreateGroup("生成设置", 16, 23, 161, 145)
$Label1 = GUICtrlCreateLabel("卡号前缀:", 24, 40, 64, 17)
$Input_card_pre = GUICtrlCreateInput($user_pre, 88, 36, 73, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetOnEvent(-1, "_mygui")
$Label2 = GUICtrlCreateLabel("附加长度:", 24, 64, 64, 17, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER))
$Input_len = GUICtrlCreateInput($user_len, 88, 60, 73, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetOnEvent(-1, "_mygui")
$Checkbox_str[0] = GUICtrlCreateCheckbox("数字", 24, 112, 49, 17)
If $user_option[0] == 1 Then GUICtrlSetState(-1, $gui_checked)
GUICtrlSetOnEvent(-1, "_selectstr")
$Checkbox_str[1] = GUICtrlCreateCheckbox("小写", 72, 112, 41, 17)
GUICtrlSetOnEvent(-1, "_selectstr")
If $user_option[1] == 1 Then GUICtrlSetState(-1, $gui_checked)
$Checkbox_str[2] = GUICtrlCreateCheckbox("大写", 118, 112, 46, 17)
GUICtrlSetOnEvent(-1, "_selectstr")
If $user_option[2] == 1 Then GUICtrlSetState(-1, $gui_checked)
$Label3 = GUICtrlCreateLabel("生成数量:", 24, 88, 64, 17)
$Input_num = GUICtrlCreateInput($user_num, 88, 84, 73, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER))
GUICtrlSetOnEvent(-1, "_mygui")
$Button_begin = GUICtrlCreateButton("生成", 24, 136, 59, 22)
GUICtrlSetOnEvent(-1, "_do_nums")
$Button_open = GUICtrlCreateButton("打开文件", 101, 136, 59, 22)
GUICtrlSetOnEvent(-1, "_mygui")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Edit_cards = GUICtrlCreateEdit("", 184, 24, 185, 145)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label_now_opr = GUICtrlCreateLabel("", 8, 182, 364, 17)
GUICtrlSetColor(-1, 0x008000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func _mygui()
Switch @GUI_CtrlId
Case $Input_card_pre
$user_pre = GUICtrlRead($Input_card_pre)
IniWrite($sysfile, "设置", "前缀", $user_pre)
_set_now_opr("已修改前缀为:" & $user_pre)
Case $Input_len
$user_len = GUICtrlRead($Input_len)
IniWrite($sysfile, "设置", "长度", $user_len)
_set_now_opr("已修改长度为:" & $user_len)
Case $Input_num
$user_num = GUICtrlRead($Input_num)
IniWrite($sysfile, "设置", "数量", $user_num)
_set_now_opr("已修改数量为:" & $user_num)
Case $Button_open
ShellExecute($file_log)
EndSwitch
EndFunc ;==>_mygui
Func _selectstr()
$checkit = 0
For $_i = 0 To 2
$user_option[$_i] = GUICtrlRead($Checkbox_str[$_i])
IniWrite($sysfile, "设置", "选项" & $_i, $user_option[$_i])
If $user_option[$_i] == 1 Then $checkit = 1
Next
If $checkit == 0 Then
_set_now_opr("不选任何项,会自动选则数字。")
$user_option[0] = 1
EndIf
EndFunc ;==>_selectstr
Func _set_now_opr($_content)
If GUICtrlRead($Label_now_opr) <> $_content Then GUICtrlSetData($Label_now_opr, $_content)
EndFunc ;==>_set_now_opr
Func _do_nums()
Local $_the_strings = "", $_ids, $_all_card = "", $_len_old
$_len_old = StringLen($user_pre) + $user_len
For $_i = 1 To $user_num
$_the_strings = $user_pre
Do
$_ids = Random(0, 2, 1)
If $user_option[$_ids] <> 1 Then ContinueLoop
$_the_strings &= Chr(Random($string_rang[$_ids][0], $string_rang[$_ids][1], 1))
Until StringLen($_the_strings) >= $_len_old
$_all_card &= $_the_strings & @CRLF
Next
_add_msg_to_edit($Edit_cards, $_all_card)
$file_log = @ScriptDir & "\生成记录" & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & ".txt"
$filehandle = FileOpen($file_log, 9)
FileWrite($filehandle, $_all_card)
FileClose($filehandle)
_set_now_opr("成功生成" & $user_num & "个卡号,已保存到文件。")
EndFunc ;==>_do_nums
Func tuichu()
Exit
EndFunc
Func _add_msg_to_edit($_edit_name, $_content)
$_old_msg = GUICtrlRead($_edit_name)
GUICtrlSetData($_edit_name, $_old_msg & $_content & @CRLF)
GUICtrlRecvMsg($_edit_name, $EM_SCROLLCARET);滚动到插入符位置
EndFunc ;==>_add_msg_to_edit