Jump to content

Recommended Posts

Posted

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

Posted

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
Posted (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 by omikron48
Posted (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 by xonepc
Posted

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.

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
×
×
  • Create New...