Jump to content

[HELP] Read File, Find String


Mumms
 Share

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)
GUICtrlCreateLabel("www.Team-vip.t83.net",10,280)
$label1 = GUICtrlCreateLabel("Made By: Chris",270,280)
GUISetState (@SW_SHOW,$GUI)

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

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)
Else
     MsgBox(0, "Error", "Login Failed." & @CRLF & "User Name / Password Was Incorrect")
     FileDelete($File_Name)
EndIf
EndFunc

The useridcheck file has a list of names:

Billy

Bob

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?

Link to comment
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]

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...