xonepc Posted September 8, 2009 Share Posted September 8, 2009 hi. Ready to record.txt file record.txt ---------- no1 -> Unique value aaaa -> Unique value no2 bsha no3 rthf no4 fh5f no5 vfgt no6 bted no7 fdfg no8 4dsf no9 4gd3 ..... -------- $code_no = InputBox("Search for code_no","Enter Code",""," M","150","150","-1","-1") Question? return code_no Link to comment Share on other sites More sharing options...
dantay9 Posted September 8, 2009 Share Posted September 8, 2009 You would use $Read = FileRead("record.txt") If StringInStr($Read, "Search String") Then MsgBox(0, "Results", "The string is in the file.") Else MsgBox(0, "Results", "The string isn't in the file.") EndIf Link to comment Share on other sites More sharing options...
xonepc Posted September 8, 2009 Author Share Posted September 8, 2009 example) want a input code : aaaa -> return code_no : no1 Link to comment Share on other sites More sharing options...
omikron48 Posted September 8, 2009 Share Posted September 8, 2009 (edited) What you can do is use FileReadLine and store your data pair into a couple variables. When the second value is the same string as the input, you return the first value. But if you're not using a whole lot of data pairs, you're better off just using an .ini file for this. Use any section name you want, then use the input code as your key and the return code as your key value. Edited September 8, 2009 by omikron48 Link to comment Share on other sites More sharing options...
xonepc Posted September 8, 2009 Author Share Posted September 8, 2009 (edited) oh.. i see.. change record.txt record.txt code_no=code_value --------------- no1=aaaa no2=fw4t no3=445f no4=5g46 ............. input code_value -> get code_no i want a code_no.. ps) data sizes are small.. Edited September 9, 2009 by xonepc Link to comment Share on other sites More sharing options...
omikron48 Posted September 9, 2009 Share Posted September 9, 2009 It's: record.txt ----- [section name] aaaa=no1 fw4t=no2 445f=no3 5g46=no4 You use: IniRead("record.txt", "section name", $key, "default") ;"default" is value returned when key isn't found. Link to comment Share on other sites More sharing options...
xonepc Posted September 9, 2009 Author Share Posted September 9, 2009 thank you~ ^~^ 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