Jump to content
Sign in to follow this  


Recommended Posts


I am making a script for creating users and save it in a txt file.. where it is "username:password" ..

this is what i have

Func create()
$file = FileOpen("file.txt",9)
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
    $lastline = FileReadLine($file,-1)
    If $lastline = "" Then
    $ID = GUICtrlRead($IDInput)
    $PW = GUICtrlRead($PassInput)
    FileWriteLine("$file", $ID & ":" & $PW & @CRLF) 



My problem is.. i want to know wether there is the string ":" in the last line because if not the line is invalid for the program that i am creating the users for and it could be deleted and a new line could be added.. so i need a function where i say.. search the string "username:password" for the ":" .. is there such a function?


Share this post

Link to post
Share on other sites

StringInStr("string", ":") can tell you if it's found in the string, also you might want to look at _FileCountlines and _FileWriteToLine.

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