Jump to content

Using Arrays To Find Data


Recommended Posts

$Read = GUICtrlRead($Password)
    $GetPasswords = GetPasswords()
    If $Read = $GetPasswords Then
    MsgBox(0, "test", "good")
    Else
;Bad
    EndIf

Func GetPasswords()

    $Pass01 = "lala"
    $Pass02 = "lolo"
    $Pass03 = "fofo"
    $Pass04 = "gogo"
    $Pass05 = "momo"
    
    $GetPass = _ArrayCreate($Pass01, $Pass02, $Pass03, $Pass04, $Pass05)
    
    Return $GetPass

EndFunc

Why doesn't this work? $Password is an input box.

Edited by =sinister=
Link to comment
Share on other sites

Ok, so I got this:

$Read = GUICtrlRead($Password)
    
;<--Passwords
    
        Dim $Pass[6]
    $Pass[0] = "String0"
    $Pass[1] = "String1"
    $Pass[2] = "String2"
    $Pass[3] = "String3"
    $Pass[4] = "String4"
    $Pass[5] = "String5"
    
;<--End Passwords
    
    $Pos = _ArraySearch ($Pass, $Password)
    If $Pos = -1 Then
;Error
Else
    MsgBox(0, "test", "good")
EndIf

Still doesn't work?

Link to comment
Share on other sites

#include <Array.au3>

$Read = GUICtrlRead($Password)
    $GetPasswords = GetPasswords()
    If _ArraySearch($GetPasswords, $Read) <> -1 Then
        MsgBox(0, "test", "good")
    Else
        MsgBox(0, "test", "bad")
    EndIf

Func GetPasswords()

    $Pass01 = "lala"
    $Pass02 = "lolo"
    $Pass03 = "fofo"
    $Pass04 = "gogo"
    $Pass05 = "momo"
    
    $GetPass = _ArrayCreate($Pass01, $Pass02, $Pass03, $Pass04, $Pass05)
    
    Return $GetPass

EndFunc
This work now, I didn't notice the array on my first post.

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...