Jump to content
Sign in to follow this  
Generator

Some problems that I encountered

Recommended Posts

Generator

Hi everyone, i am making a password thing so i can use it in my project. This is what I've done to test if it actually works.

Unfortunatly it doesn't for me, TrayIconDebug didn't help out(Not sure how to use it). The code is below. Self explained.

Can anyone please point out the problem or give me a hint?

Thanks in advance. :)

Edit: Check Post #5 for current code.

#Include<GUIConstants.au3>
Opt("GUIOnEventMode",1)
Opt("TrayIconDebug",1)
Global $Inuse=False, $passwordfrm,$string1, $string2, $password=""
$mainfrm=GUICreate("Main Form",200,35,-1,-1,-1)
$button0=GUICtrlCreateButton("Password",1,1,98,30)
$button1=GUICtrlCreateButton("Check",99,1,98,30)
GUICtrlSetFont($button0,9,400,0,"Tahoma")
GUICtrlSetFont($button1,9,400,0,"Tahoma")
GUISetFont(9,400,0,"Tahoma")
GUICtrlSetOnEvent($button0,"_PasswordGUI")
GUICtrlSetOnEvent($button1,"_ShowPassword")
GUISetOnEvent($GUI_EVENT_CLOSE,"Quit")
GUISetState()
While 1
    Sleep(1000)
WEnd
Func _PasswordGUI()
    If $Inuse=True Then Return
    $Inuse=Not $Inuse
    $passwordfrm=GUICreate("Password Protection",400,60,-1,-1,-1,-1,$mainfrm)
    $string1=GUICtrlCreateLabel("Type Password: ",1,1,120,20,$SS_CENTER)
    $string2=GUICtrlCreateLabel("Confirm Password: ",1,32,120,20,$SS_CENTER)
    $firstpw=GUICtrlCreateInput("",121,3,210,20)
    $confirmpw=GUICtrlCreateInput("",121,32,210,20)
    $setbutton=GUICtrlCreateButton("SET",336,3,60,51,$BS_VCENTER)
    GUICtrlSetFont($string1,11,400,0,"Tahoma")
    GUICtrlSetFont($string2,11,400,0,"Tahoma")
    GUICtrlSetFont($setbutton,11,400,0,"Tahoma")
    GUISetOnEvent($GUI_EVENT_CLOSE,"Subdel")
    GUISetOnEvent($setbutton,"_SetPassword")
    GUISetState()
EndFunc
Func _ShowPassword()
    Msgbox(64,"Password",$password)
EndFunc
Func Subdel()
    $Inuse=Not $Inuse
    GUIDelete($passwordfrm)
EndFunc
Func _PasswordChk()
    If StringLen(GUICtrlRead($string1)) <> StringLen(GUICtrlRead($string2))Then
        MsgBox(64,"Password Check","Please confirm both of your password")
        Return
    ElseIf GUICtrlRead($string1) <> GUICtrlRead($string2) Then
        MsgBox(64,"Password Check","Please confirm both of your password")
        Return
    ElseIf IsNumber(GUICtrlRead($string1))=1 Or IsNumber(GUICtrlRead($string1))=1 Then
        MsgBox(64,"Password Check","Numeric Type password may not be safe, please re-consider")
        Return
    EndIf
    Return $string2
EndFunc
Func _SetPassword()
    Local $ButtonPos=WinGetPos($passwordfrm,"")
    If IsNumber(_PasswordChk())=1 Then
        $string2=$password
        ToolTip("Password was set, please remember",$ButtonPos[0]+350,$ButtonPos[1]+55,"Result",-1,-1)
        Sleep(800)
        ToolTip("")
        Return $password
    Else
        ToolTip("Password was not set",$ButtonPos[0]+350,$ButtonPos[1]+55,"Result",-1,-1)
        Sleep(800)
        ToolTip("")
    EndIf
EndFunc
Func Quit()
    Exit
EndFunc
Edited by Generator

Share this post


Link to post
Share on other sites
smashly

Hi,

Offending entry is .. drum roll...

GUISetOnEvent($setbutton,"_SetPassword")oÝ÷ Ù(hºW[y«­¢+ÙU%
ÑɱMÑ=¹Ù¹Ð ÀÌØíÍÑÕÑѽ¸°ÅÕ½Ðí}MÑAÍÍݽÉÅÕ½Ðì¤oÝ÷ Ù(hºW[y«­¢+Ù%MÑÉ¥¹1¸¡U%
ÑɱI ÀÌØí¥ÉÍÑÁܤ¤±ÐìÐìMÑÉ¥¹1¸¡U%
ÑɱI ÀÌØí½¹¥ÉµÁܤ¥Q¡

You need to change the other instances of this as well.

More to come ...

Edited by smashly

Share this post


Link to post
Share on other sites
Generator

Hi,

Offending entry is .. drum roll...

GUISetOnEvent($setbutton,"_SetPassword")oÝ÷ Ù(hºW[y«­¢+ÙU%
ÑɱMÑ=¹Ù¹Ð ÀÌØíÍÑÕÑѽ¸°ÅÕ½Ðí}MÑAÍÍݽÉÅÕ½Ðì¤

Cheers

Oh my god! :) Thanks a lot.

But something i am wondering, i tried. I entered haha and haha as password, but it shows they are not equal. Any idea why?

StringLen suppose to return len and <> is not equal. But then it doesn't work. :\

Anyone would like to help out? :)

Thanks.

Share this post


Link to post
Share on other sites
smashly

Keep checking my first post .. as I'll keep updating it as I find the errors..

Share this post


Link to post
Share on other sites
Generator

Keep checking my first post .. as I'll keep updating it as I find the errors..

Thanks a lot.

Edit: Still doesn't work as what I want it to be. Updated code.

#Include<GUIConstants.au3>
Opt("GUIOnEventMode",1)
Opt("TrayIconDebug",1)
Global $Inuse=False, $passwordfrm,$string1, $string2, $password=""
$mainfrm=GUICreate("Main Form",200,35,-1,-1,-1)
$button0=GUICtrlCreateButton("Password",1,1,98,30)
$button1=GUICtrlCreateButton("Check",99,1,98,30)
GUICtrlSetFont($button0,9,400,0,"Tahoma")
GUICtrlSetFont($button1,9,400,0,"Tahoma")
GUISetFont(9,400,0,"Tahoma")
GUICtrlSetOnEvent($button0,"_PasswordGUI")
GUICtrlSetOnEvent($button1,"_ShowPassword")
GUISetOnEvent($GUI_EVENT_CLOSE,"Quit")
GUISetState()
While 1
    Sleep(1000)
WEnd
Func _PasswordGUI()
    If $Inuse=True Then Return
    $Inuse=Not $Inuse
    $passwordfrm=GUICreate("Password Protection",400,60,-1,-1,-1,-1,$mainfrm)
    $label1=GUICtrlCreateLabel("Type Password: ",1,1,120,20,$SS_CENTER)
    $label2=GUICtrlCreateLabel("Confirm Password: ",1,32,120,20,$SS_CENTER)
    $string1=GUICtrlCreateInput("",121,3,210,20)
    $string2=GUICtrlCreateInput("",121,32,210,20)
    $setbutton=GUICtrlCreateButton("SET",336,3,60,51,$BS_VCENTER)
    GUICtrlSetFont($label1,11,400,0,"Tahoma")
    GUICtrlSetFont($label2,11,400,0,"Tahoma")
    GUICtrlSetFont($string1,11,400,0,"Tahoma")
    GUICtrlSetFont($string2,11,400,0,"Tahoma")
    GUICtrlSetFont($setbutton,11,400,0,"Tahoma")
    GUICtrlSetOnEvent($setbutton,"_SetPassword")
    GUISetOnEvent($GUI_EVENT_CLOSE,"Subdel")
    GUISetState()
EndFunc
Func _ShowPassword()
    Msgbox(64,"Password",$password)
EndFunc
Func Subdel()
    $Inuse=Not $Inuse
    GUIDelete($passwordfrm)
EndFunc
Func _PasswordChk()
    If StringLen(GUICtrlRead($string1)) <> StringLen(GUICtrlRead($string2))Then
        MsgBox(64,"Password Check","Please confirm both of your password")
        Return
    ElseIf GUICtrlRead($string1) <> GUICtrlRead($string2) Then
        MsgBox(64,"Password Check","Please confirm both of your password")
        Return
    ElseIf IsNumber(GUICtrlRead($string1))=1 Or IsNumber(GUICtrlRead($string2))=1 Then
        MsgBox(64,"Password Check","Numeric Type password may not be safe, please re-consider")
        Return
    EndIf
    Return $string2
EndFunc
Func _SetPassword()
    Local $ButtonPos=WinGetPos($passwordfrm,"")
    If IsNumber(_PasswordChk())=0 Then
        $string2=$password
        ToolTip("Password was set, please remember",$ButtonPos[0]+370,$ButtonPos[1]+55,"Result",-1,-1)
        Sleep(800)
        ToolTip("")
        Return $password
    Else
        ToolTip("Password was not set",$ButtonPos[0]+370,$ButtonPos[1]+55,"Result",-1,-1)
        Sleep(800)
        ToolTip("")
    EndIf
EndFunc
Func Quit()
    Exit
EndFunc
Edited by Generator

Share this post


Link to post
Share on other sites
smashly

Here you go.. it works, but your code still needs tidying up :)

#Include<GUIConstants.au3>
Opt("GUIOnEventMode",1)
Opt("TrayIconDebug",1)
Global $Inuse=False, $passwordfrm, $firstpw, $confirmpw, $password=""
$mainfrm=GUICreate("Main Form",200,35,-1,-1,-1)
$button0=GUICtrlCreateButton("Password",1,1,98,30)
$button1=GUICtrlCreateButton("Check",99,1,98,30)
GUICtrlSetFont($button0,9,400,0,"Tahoma")
GUICtrlSetFont($button1,9,400,0,"Tahoma")
GUISetFont(9,400,0,"Tahoma")
GUICtrlSetOnEvent($button0,"_PasswordGUI")
GUICtrlSetOnEvent($button1,"_ShowPassword")
GUISetOnEvent($GUI_EVENT_CLOSE,"Quit")
GUISetState()
While 1
    Sleep(1000)
WEnd
Func _PasswordGUI()
    If $Inuse=True Then Return
    $Inuse=Not $Inuse
    $passwordfrm=GUICreate("Password Protection",400,60,-1,-1,-1,-1,$mainfrm)
    $string1 = GUICtrlCreateLabel("Type Password: ",1,1,120,20,$SS_CENTER)
    $string2 =  GUICtrlCreateLabel("Confirm Password: ",1,32,120,20,$SS_CENTER)
    $firstpw=GUICtrlCreateInput("",121,3,210,20)
    $confirmpw=GUICtrlCreateInput("",121,32,210,20)
    $setbutton=GUICtrlCreateButton("SET",336,3,60,51,$BS_VCENTER)
    GUICtrlSetFont($string1,11,400,0,"Tahoma")
    GUICtrlSetFont($string2,11,400,0,"Tahoma")
    GUICtrlSetFont($setbutton,11,400,0,"Tahoma")
    GUISetOnEvent($GUI_EVENT_CLOSE,"Subdel")
    GUICtrlSetOnEvent($setbutton,"_SetPassword")
    GUISetState()
EndFunc
Func _ShowPassword()
    Msgbox(64,"Password",$password)
EndFunc
Func Subdel()
    $Inuse=Not $Inuse
    GUIDelete($passwordfrm)
EndFunc
Func _PasswordChk()
    If GUICtrlRead($firstpw) <> GUICtrlRead($confirmpw) Or GUICtrlRead($firstpw) = "" Or  GUICtrlRead($confirmpw) = "" Then
        MsgBox(64,"Password Check","Please confirm both of your password")
        Return
    ElseIf IsNumber(GUICtrlRead($firstpw)) = 1 Or IsNumber(GUICtrlRead($confirmpw)) = 1 Then
        MsgBox(64,"Password Check","Numeric Type password may not be safe, please re-consider")
        Return
    EndIf
    Return 
EndFunc

Func _SetPassword()
    Local $ButtonPos=WinGetPos($passwordfrm,"")
    If IsNumber(_PasswordChk())=1 Then
        $password = GUICtrlRead($confirmpw) 
        ToolTip("Password was set, please remember",$ButtonPos[0]+350,$ButtonPos[1]+55,"Result",-1,-1)
        Sleep(800)
        ToolTip("")
        Return $password
    Else
        ToolTip("Password was not set",$ButtonPos[0]+350,$ButtonPos[1]+55,"Result",-1,-1)
        Sleep(800)
        ToolTip("")
    EndIf
EndFunc

Func Quit()
    Exit
EndFunc

Cheers

Edited by smashly

Share this post


Link to post
Share on other sites
Valuater

maybe...

#Include<GUIConstants.au3>
Opt("GUIOnEventMode",1)
Opt("TrayIconDebug",1)
Global $Inuse=False, $passwordfrm,$string1, $string2, $password=""

$mainfrm=GUICreate("Main Form",200,35,-1,-1,-1)
$button0=GUICtrlCreateButton("Password",1,1,98,30)
$button1=GUICtrlCreateButton("Check",99,1,98,30)
GUICtrlSetFont($button0,9,400,0,"Tahoma")
GUICtrlSetFont($button1,9,400,0,"Tahoma")
GUISetFont(9,400,0,"Tahoma")
GUICtrlSetOnEvent($button0,"_PasswordGUI")
GUICtrlSetOnEvent($button1,"_ShowPassword")
GUISetOnEvent($GUI_EVENT_CLOSE,"Quit")
GUISetState()

While 1
    Sleep(10)
WEnd

Func _PasswordGUI()
    If $Inuse=True Then Return
    $Inuse=Not $Inuse
    $passwordfrm=GUICreate("Password Protection",400,60,-1,-1,-1,-1,$mainfrm)
    $label1=GUICtrlCreateLabel("Type Password: ",1,1,120,20,$SS_CENTER)
    $label2=GUICtrlCreateLabel("Confirm Password: ",1,32,120,20,$SS_CENTER)
    $string1=GUICtrlCreateInput("",121,3,210,20)
    $string2=GUICtrlCreateInput("",121,32,210,20)
    $setbutton=GUICtrlCreateButton("SET",336,3,60,51,$BS_VCENTER)
    GUICtrlSetFont($label1,11,400,0,"Tahoma")
    GUICtrlSetFont($label2,11,400,0,"Tahoma")
    GUICtrlSetFont($string1,11,400,0,"Tahoma")
    GUICtrlSetFont($string2,11,400,0,"Tahoma")
    GUICtrlSetFont($setbutton,11,400,0,"Tahoma")
    GUICtrlSetOnEvent($setbutton,"_SetPassword")
    GUISetOnEvent($GUI_EVENT_CLOSE,"Subdel")
    GUISetState()
EndFunc
Func _ShowPassword()
    Msgbox(64,"Password",$password)
EndFunc
Func Subdel()
    $Inuse=Not $Inuse
    GUIDelete($passwordfrm)
EndFunc
Func _PasswordChk()
    If StringLen(GUICtrlRead($string1)) <> StringLen(GUICtrlRead($string2))Then
        MsgBox(64,"Password Check","Please confirm both of your password")
        Return
    ElseIf GUICtrlRead($string1) <> GUICtrlRead($string2) Then
        MsgBox(64,"Password Check","Please confirm both of your password")
        Return
    ElseIf IsNumber(GUICtrlRead($string1))=1 Or IsNumber(GUICtrlRead($string2))=1 Then
        MsgBox(64,"Password Check","Numeric Type password may not be safe, please re-consider")
        Return
    EndIf
    Return GUICtrlRead($string2)
EndFunc
Func _SetPassword()
    Local $ButtonPos=WinGetPos($passwordfrm,"")
    If IsNumber(_PasswordChk())=0 Then
        $password=GUICtrlRead($string2)
        ToolTip("Password was set, please remember",$ButtonPos[0]+370,$ButtonPos[1]+55,"Result",-1,-1)
        Sleep(3000)
        ToolTip("")
        Return $password
    Else
        ToolTip("Password was not set",$ButtonPos[0]+370,$ButtonPos[1]+55,"Result",-1,-1)
        Sleep(3000)
        ToolTip("")
    EndIf
EndFunc
Func Quit()
    Exit
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Generator

Thanks a lot guys. Espeically smashly and Valuater, and yet it worked.

Share this post


Link to post
Share on other sites
Valuater

Thanks a lot guys. Espeically smashly and Valuater, and yet it worked.

Welcome...

just didn't know that smashly got there first

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Generator

Any idea why won't the input box have Password attribute?

Share this post


Link to post
Share on other sites
Sokko

You're putting $ES_PASSWORD in the extended style parameter, instead of the style parameter.

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  

×