#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
$name = ''
$fam = ''
$typeUser = ''
$maName = ''
$maFam = ''
$cID = ''
$endName = ''
$endFam = ''
$Gui = GUICreate("Генератор id", 349, 367, 192, 124)
$MenuFile = GUICtrlCreateMenu("Файл")
$MenuExit = GUICtrlCreateMenuItem("Выход", $MenuFile)
$MenuHelp = GUICtrlCreateMenu("Справка")
$MenuAbout = GUICtrlCreateMenuItem("О программе...", $MenuHelp)
$Group1 = GUICtrlCreateGroup("Данные Пользователя", 15, 15, 316, 160)
$nameL = GUICtrlCreateLabel("Имя:", 57, 60, 29, 17)
$sName = GUICtrlCreateInput("", 93, 57, 226, 21)
$famL = GUICtrlCreateLabel("Фамилия:", 30, 96, 56, 17)
$sFam = GUICtrlCreateInput("", 93, 93, 226, 21)
$sTypeUser = GUICtrlCreateCombo("", 93, 129, 223, 25, $CBS_DROPDOWNLIST);не редактируемый
GUICtrlSetData(-1, "тип1"|"тип2", "тип1")
$Label1 = GUICtrlCreateLabel("Тип учетки:", 24, 132, 62, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$idGroup = GUICtrlCreateGroup("Идентификатор", 15, 186, 316, 73)
$id = GUICtrlCreateInput("", 24, 216, 208, 21, $ES_READONLY)
$copy = GUICtrlCreateButton("Копировать", 237, 213, 85, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$start = GUICtrlCreateButton("Генерировать", 15, 276, 316, 46, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
If $nMsg = $MenuExit Then
ExitLoop
EndIf
If $nMsg = $MenuAbout Then
MsgBox(64, "О программе...","Пример генерации id пользователя")
EndIf
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
Case $sTypeUser
Switch GUICtrlRead($sTypeUser)
Case "тип1"
GUICtrlSetData($sTypeUser, "тип1")
Case "тип2"
GUICtrlSetData($sTypeUser, "тип2")
EndSwitch
Case $start
_start()
GUICtrlSetData( $id, $cID)
Case $copy
ClipPut ( $cID )
EndSwitch
WEnd
Func _start ()
$name = GUICtrlRead($sName)
$fam = GUICtrlRead($sFam)
$typeUser = GUICtrlRead($sTypeUser)
If $typeUser = 'тип1' Then
_crypt ()
$cID=$maName[1][2] & $maFam[3][3] & $maName[2][1] & $maFam[1][1] & $maName[3][3] & $maFam[2][2] & '/' & $endName & '/' & $endFam
Else
_crypt ()
$cID=$maName[1][3] & $maFam[2][1] & $maName[2][2] & $maFam[2][1] & $maName[3][1] & $maFam[3][1] & '/' & $endName & '/' & $endFam
EndIf
EndFunc ;==>_start
Func _crypt ()
Dim $aTop[33][2] = [['а','б'],['б','в'],['в','г'],['г','д'],['д','е'],['е','ё'],['ё','ж'],['ж','з'],['з','и'],['и','й'], _
['й','к'],['к','л'],['л','м'],['м','н'],['н','о'],['о','п'],['п','р'],['р','с'],['с','т'],['т','у'], _
['у','ф'],['ф','х'],['х','ц'],['ц','ч'],['ч','ш'],['ш','щ'],['щ','ъ'],['ъ','ы'],['ы','ь'],['ь','э'], _
['э','ю'],['ю','я'],['я','а'], _
Dim $aDown[33][2] = [['а','в'],['б','г'],['в','д'],['г','е'],['д','ё'],['е','ж'],['ё','з'],['ж','и'],['з','й'],['и','к'], _
['л','a'],['к','м'],['л','н'],['м','о'],['н','п'],['о','р'],['п','с'],['р','т'],['с','у'],['т','ф'], _
['у','х'],['ф','ц'],['х','ч'],['ц','ш'],['ч','щ'],['ш','ъ'],['щ','ы'],['ъ','ь'],['ы','э'],['ь','ю'], _
['э','я'],['ю','а'],['я','б'], _
Dim $aCyfer[33][2] = [['а','1'],['б','2'],['в','3'],['г','4'],['д','5'],['е','6'],['ё','7'],['ж','8'],['з','9'],['и','1'], _
['й','2'],['к','3'],['л','4'],['м','5'],['н','6'],['о','7'],['п','8'],['р','9'],['с','1'],['т','2'], _
['у','3'],['ф','4'],['х','5'],['ц','6'],['ч','7'],['ш','8'],['щ','9'],['ъ','1'],['ы','2'],['ь','3'], _
['э','4'],['ю','5'],['я','6'], _
$aName = StringSplit ( $name, "",0 )
$aFam = StringSplit ( $fam, "",0 )
$sNameTop = $name
$sNameDown = $name
$sNameCyfer = $name
$sFamTop = $fam
$sFamDown = $fam
$sFamCyfer = $fam
For $i = 0 To $i = 33 -1 ; если вместо $i=33 пишу UBound($aTop), то вобще не обрабатывается((
$sNameTop = StringRegExpReplace($sNameTop, $aTop[$i][0], $aTop[$i][1])
$sFamTop = StringRegExpReplace($sFamTop, $aTop[$i][0], $aTop[$i][1])
Next
For $i = 0 To $i = 33 -1
$sNameDown = StringRegExpReplace($sNameDown, $aDown[$i][0], $aDown[$i][1])
$sFamDown = StringRegExpReplace($sFamDown, $aDown[$i][0], $aDown[$i][1])
Next
For $i = 0 To $i = 33 -1
$sNameCyfer = StringRegExpReplace($sNameCyfer, $aCyfer[$i][0], $aCyfer[$i][1])
$sFamCyfer = StringRegExpReplace($sFamCyfer, $aCyfer[$i][0], $aCyfer[$i][1])
Next
$aNameTop = StringSplit ($sNameTop, "",0 )
$aNameDown = StringSplit ($sNameDown, "",0 )
$aNameCyfer = StringSplit ($sNameCyfer, "",0 )
$aFamTop = StringSplit ($sFamCyfer, "",0 )
$aFamDown = StringSplit ($sFamCyfer, "",0 )
$aFamCyfer = StringSplit ($sFamCyfer, "",0 )
;_ArrayDisplay($aNameTop)
;_ArrayDisplay($aNameDown)
;_ArrayDisplay($aNameCyfer)
;_ArrayDisplay($aFamTop)
;_ArrayDisplay($aFamDown)
;_ArrayDisplay($aFamCyfer)
$endName = StringTrimLeft ( $sNameTop, 3 )
$endFam = StringTrimLeft ( $sFamDown, 3 )
$maName = _makeArrays($aName, $aNameTop, $aNameDown, $aNameCyfer)
$maFam = _makeArrays($aFam, $aFamTop, $aFamDown, $aFamCyfer)
_ArrayDisplay($maName)
_ArrayDisplay($maFam)
EndFunc ;==>_crypt
Func _makeArrays(ByRef $array1, ByRef $array2 , ByRef $array3, ByRef $array4)
Local $results[UBound($array1)][4]
Local $iSize = UBound($array1) - 1
For $i = 0 To $iSize
If UBound($array1) > $i Then $results[$i][0] = $array1[$i]
If UBound($array2) > $i Then $results[$i][1] = $array2[$i]
If UBound($array3) > $i Then $results[$i][2] = $array3[$i]
If UBound($array4) > $i Then $results[$i][3] = $array4[$i]
Next
Return $results
EndFunc ;==>_makeArrays