Jump to content
Sign in to follow this  

[HELP] Read File, Find String

Recommended Posts


#include <Misc.au3>
#include <GUIConstantsEx.au3>

Global $Name
Global $Pass
;Global $ServerRcon
Global $pixelradius = 16 
Global $id2Find

$GUI = GUICreate("| Team.v!p | Remote Rcon", 360, 300, (@Desktopwidth - 360)/2, (@Desktopheight - 300)/2)
GUICtrlCreateGroup ("", 10, 10, 340, 260)
GUICtrlCreateLabel("User Name: ", 25,125,100,20) 
$Name = GUICtrlCreateInput("Name",185,120,150,20)
GUICtrlCreateLabel("Password: ", 25,165,100,20) 
$Pass = GUICtrlCreateInput("Name" ,185,160,150,20)
;GUICtrlCreateLabel("Rcon Password: ", 25,165,100,20) 
;$ServerRcon = GUICtrlCreateInput("",185,160,150,20)
$button1 =GuiCtrlCreateButton("Login",115,235,100,20)
$label1 = GUICtrlCreateLabel("Made By: Chris",270,280)

While 1
If $msg=-3 Then Exit
If $msg = $button1 Then
            $Ansid = GUICtrlRead($Name)
            ;MsgBox("", "", $Ansid)

Func button1()
$Download_Link = 'http://vip-downloads.webs.com/test.txt'
$File_Name = 'useridcheck'
$Download = INetGet ($Download_Link, $File_Name, 1, 1)
;opening file for reading
$id2Find = FileRead($File_Name)
If StringCompare($id2Find, $Ansid, 1) == 0 Then
    MsgBox(0, "Test", $Ansid)
     MsgBox(0, "Error", "Login Failed." & @CRLF & "User Name / Password Was Incorrect")

The useridcheck file has a list of names:



etc. What i want it to do is read that file, and if the username matches one of those names in the file, then my program continues, if it doesnt match then it comes up with error.

Can Anyone Help Me?

Share this post

Link to post
Share on other sites

I would start by looking at FileReadToArray(). From there you can iterate through the list for a match.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.