germinator Posted March 19, 2009 Share Posted March 19, 2009 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.") Exit EndIf $lastline = FileReadLine($file,-1) If $lastline = "" Then $ID = GUICtrlRead($IDInput) $PW = GUICtrlRead($PassInput) FileWriteLine("$file", $ID & ":" & $PW & @CRLF) EndIf FileClose($file) EndFunc 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? -Germinator Link to comment Share on other sites More sharing options...
foster74 Posted March 19, 2009 Share Posted March 19, 2009 StringInStr("string", ":") can tell you if it's found in the string, also you might want to look at _FileCountlines and _FileWriteToLine. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now