Log In Box

07/16/2011 16:37 Dr.N00B#1
Hi,
ich habe ein schönes Script für ne Log In Box gebaut, natürlich *.au3!


Code:
#include<GuiImageList.au3>
#include<ComboConstants.au3>
#include<ButtonConstants.au3>
#include<EditConstants.au3>
#include<GUIConstantsEx.au3>
#include<WindowsConstants.au3>

Global $aCorrect[2] = ['Member', 'epvp'] ;einfach ändern!

;  Mögliche Werte für die Sprache: 'Dansk|Deutsch|English|Français'
Global $array = _LogInBox('Log In', 2, 'Deutsch'); Fenstertitel = "Log In", Passwort = min. 4 Zeichen, Standartsprache = Deutsch

If Not @error Then
    If $array[0] == $aCorrect[0] And $array[1] == $aCorrect[1] Then ; "==" Groß-/Kleinschreibung beachten!
        MsgBox(0, 'Log In erfolreich!', 'Benutzername und Passwort sind richtig!') ;nun die Nachricht beim richtigen Daten
		MsgBox (0, "THX", "Wäre nett wenn ein THX drin wäre!");hier weiter scripten!
   Else
        MsgBox(0, 'Log in fehlgeschlagen!', 'Benutzername und/oder Passwort falsch!')
    EndIf
EndIf
;Nun ist die Log In Box eingestellt!

Func _LogInBox($sTitle, $iMinLen = 0, $sStartLang = 'Deutsch', $bPassVisible = False, $iXPos = -1, $iYPos = -1)
	If $iMinLen < 0 Or $iMinLen = Default Then $iMinLen = 0
	If $sStartLang = -1 Or $sStartLang = Default Then $sStartLang = 'Deutsch'
	If $bPassVisible = -1 Or $bPassVisible = Default Then $bPassVisible = False
	If $iXPos < 0 Or $iXPos = Default Or $iXPos > @DesktopWidth Then $iXPos = -1
	If $iYPos < 0 Or $iYPos = Default Or $iXPos > @DesktopHeight Then $iYPos = -1
	Local $hGui, $hUserLabel, $hUser, $hPass, $hCheck, $hLanguage, $hCancel, $hOk
	Local $iOpt, $sStyle, $sTmp, $aLanguage, $iLanguage, $hImage
	Local $iErr, $sFont = 'Arial', $aOut[2]
	Local $iBGColorInner = 0xDDDDDD, $iBGColorOuter = 0xAAAAAA
	Local $sIconsPath = @ScriptDir & '\icons.icl'
	Local $sLang = 'Dansk|Deutsch|English|Français'
	Local $aTranslation[4][7] = [ _
	['Brugernavn:' & @CRLF & '(påkrævet)', _ ; Dänisch
	'Password:', _
	@CRLF & '(mindst ' & $iMinLen & ' tegn)', _
	'&Password synlige', _
	'Abonner...', _
	'Annuller', ''], _
	['Benutzername:' & @CRLF & '(erforderlich)', _ ; Deutsch
	'Passwort:', _
	@CRLF & '(min. ' & $iMinLen & ' Zeichen)', _
	'&Passwort sichtbar', _
	'Anmelden...', _
	'Abbrechen', ''], _
	['Username:' & @CRLF & '(needed)', _ ; Englisch
	'Password:', _
	@CRLF & '(min. ' & $iMinLen & ' Chars)', _
	'&Password visible', _
	'Log in...', _
	'Cancel', ''], _
	['Nom:' & @CRLF & '(nécessaire)', _ ; Französisch
	'mot de passe:', _
	@CRLF & '(min. ' & $iMinLen & ' lettre)', _
	'&mot de passe visible', _
	'déclarer...', _
	'Annuler', '']]
	$aLanguage = StringSplit($sLang, '|')
	For $i = 1 To $aLanguage[0]
		If $sStartLang = $aLanguage[$i] Then $iLanguage = $i - 1
	Next
	$iOpt = Opt('GUIOnEventMode', 0)
	$hGui = GUICreate($sTitle, 343, 200, $iXPos, $iYPos, BitOR($WS_SYSMENU, $DS_SETFOREGROUND))
	GUISetIcon(@SystemDir & "\shell32.dll", -212)
	GUISetBkColor($iBGColorOuter)
	GUICtrlCreateLabel('', 5, 5, 325, 120, -1, $WS_EX_CLIENTEDGE)
	GUICtrlSetState(-1, $GUI_DISABLE)
	GUICtrlSetBkColor(-1, $iBGColorInner)
	$hUserLabel = GUICtrlCreateLabel($aTranslation[$iLanguage][0], 12, 17, 90, 35)
	GUICtrlSetFont(-1, 9, 400, 0, $sFont)
	GUICtrlSetBkColor(-1, $iBGColorInner)
	$hUser = GUICtrlCreateInput('', 115, 20, 210, 25, $WS_TABSTOP)
	GUICtrlSetFont(-1, 10, 400, 0, $sFont)
	If $iMinLen > 0 Then
		$aTranslation[$iLanguage][6] = $aTranslation[$iLanguage][1] & $aTranslation[$iLanguage][2]
	Else
		$aTranslation[$iLanguage][6] = $aTranslation[$iLanguage][1]
	EndIf
	$hPassLabel = GUICtrlCreateLabel($aTranslation[$iLanguage][6], 12, 63 + ($iMinLen = 0) * 6, 100, 35)
	GUICtrlSetFont(-1, 9, 400, 0, $sFont)
	GUICtrlSetBkColor(-1, $iBGColorInner)
	If $bPassVisible Then
		$sStyle = BitOR($ES_AUTOHSCROLL, $WS_TABSTOP)
	Else
		$sStyle = BitOR($ES_PASSWORD, $ES_AUTOHSCROLL, $WS_TABSTOP)
	EndIf
	$hPass = GUICtrlCreateInput('', 115, 65, 210, 25, $sStyle)
	GUICtrlSetFont(-1, 10, 400, 0, $sFont)
	$hCheck = GUICtrlCreateCheckbox($aTranslation[$iLanguage][3], 120, 92, 200, 25)
	GUICtrlSetFont(-1, 9, 400, 0, $sFont)
	GUICtrlSetBkColor(-1, $iBGColorInner)
	If $bPassVisible Then GUICtrlSetState(-1, $GUI_CHECKED)
	$hLanguage = _GUICtrlComboBoxEx_Create($hGui, '', 10, 135, 110, 140, $CBS_DROPDOWNLIST)
	If FileExists($sIconsPath) Then
		$hImage = _GUIImageList_Create(32, 20, 5, 4, 4)
		_GUIImageList_AddIcon($hImage, $sIconsPath, 0, True)
		_GUIImageList_AddIcon($hImage, $sIconsPath, 1, True)
		_GUIImageList_AddIcon($hImage, $sIconsPath, 2, True)
		_GUIImageList_AddIcon($hImage, $sIconsPath, 3, True)
		_GUICtrlComboBoxEx_SetImageList($hLanguage, $hImage)
	EndIf
	_GUICtrlComboBoxEx_SetItemHeight($hLanguage, 0, 25)
	For $i = 1 To $aLanguage[0]
		_GUICtrlComboBoxEx_AddString($hLanguage, $aLanguage[$i], $i-1, $i-1)
	Next
	_GUICtrlComboBoxEx_SetCurSel($hLanguage, $iLanguage)
	GUICtrlSetFont(-1, 10, 400, 0, $sFont)
	$hCancel = GUICtrlCreateButton($aTranslation[$iLanguage][5], 250, 135, 80, 25)
	GUICtrlSetFont(-1, 9, 400, 0, $sFont)
	$hOk = GUICtrlCreateButton($aTranslation[$iLanguage][4], 160, 135, 80, 25, $BS_DEFPUSHBUTTON)
	GUICtrlSetFont(-1, 9, 400, 0, $sFont)
	GUICtrlSetState(-1, $GUI_DISABLE)
	GUISetState()
	WinSetOnTop($sTitle, '', 1)
	While 1
		Switch GUIGetMsg()
			Case $GUI_EVENT_CLOSE, $hCancel
				$iErr = 1
				ExitLoop
			Case $hCheck
				If BitAND(GUICtrlRead($hCheck), $GUI_CHECKED) Then
					$sTmp = GUICtrlRead($hPass)
					GUICtrlDelete($hPass)
					$hPass = GUICtrlCreateInput($sTmp, 115, 65, 210, 25)
					GUICtrlSetFont(-1, 10, 400, 0, $sFont)
					GUICtrlSetState(-1, $GUI_FOCUS)
				Else
					$sTmp = GUICtrlRead($hPass)
					GUICtrlDelete($hPass)
					$hPass = GUICtrlCreateInput($sTmp, 115, 65, 210, 25, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
					GUICtrlSetFont(-1, 10, 400, 0, $sFont)
					GUICtrlSetState(-1, $GUI_FOCUS)
				EndIf
			Case $hOk
				$aOut[0] = GUICtrlRead($hUser)
				$aOut[1] = GUICtrlRead($hPass)
				ExitLoop
		EndSwitch
		If Not _GUICtrlComboBoxEx_GetDroppedState($hLanguage) Then
			If _GUICtrlComboBoxEx_GetCurSel($hLanguage) <> $iLanguage Then
				$iLanguage = _GUICtrlComboBoxEx_GetCurSel($hLanguage)
				If $iMinLen > 0 Then
					$aTranslation[$iLanguage][6] = $aTranslation[$iLanguage][1] & $aTranslation[$iLanguage][2]
				Else
					$aTranslation[$iLanguage][6] = $aTranslation[$iLanguage][1]
				EndIf
				GUICtrlSetData($hUserLabel, $aTranslation[$iLanguage][0]) 
				GUICtrlSetData($hPassLabel, $aTranslation[$iLanguage][6]) 
				GUICtrlSetData($hCheck, $aTranslation[$iLanguage][3]) 
				GUICtrlSetData($hCancel, $aTranslation[$iLanguage][5]) 
				GUICtrlSetData($hOk, $aTranslation[$iLanguage][4]) 
				GUICtrlSetState($hUser, $GUI_FOCUS)
			EndIf
		EndIf
		If GUICtrlRead($hUser) <> '' And StringLen(GUICtrlRead($hPass)) >= $iMinLen Then
			If BitAND(GUICtrlGetState($hOk), $GUI_DISABLE) Then GUICtrlSetState($hOk, $GUI_ENABLE)
		Else
			If BitAND(GUICtrlGetState($hOk), $GUI_ENABLE) Then GUICtrlSetState($hOk, $GUI_DISABLE)
		EndIf
	WEnd
	Opt('GUIOnEventMode', $iOpt)
	GUIDelete($hGui)
	Return SetError($iErr, 0, $aOut)
EndFunc   ;==>_LogInBox
THX und Credits bei Benutzung wäre nett!

Hoffe euch bringts was!

Dann mal ByeBye!
07/16/2011 17:30 | Moep |#2
E*pvp != Twitter
07/17/2011 17:13 Dr.N00B#3
Quote:
Originally Posted by | Moep | View Post
E*pvp != Twitter

Sorry, aber man braucht den Link für den THX Checker, und deswegen kam der Thread davor...obwohl ich es immer noch nicht schaffe das er es richtig anzeigt!

Edit: gebe es auf mit dem THX Checker, Script für die Box oben!
07/17/2011 17:15 | Moep |#4
Ja, weil so wies gerade aussieht kann niemand was mit anfangen sorry.
07/17/2011 20:32 Kronasify#5
Ich verstehe grade den sinn des themas hier nicht^^
07/18/2011 03:14 Freddy​#6
Quote:
Originally Posted by Kronasify View Post
Ich verstehe grade den sinn des themas hier nicht^^
Ergibt auch kein sinn darum reported