vickerps Posted November 11, 2004 Posted November 11, 2004 Hi GuysI am having problems with the format of a number. I want to do a look up a ini which has info such as [Number]001=y002=n....056=y..360=netcBasically i want autoit to look up the value in a loop. However the FOR statment go up like 1,2,3,4 where want it to go up like 001,002,003, etchere what i've wroteexpandcollapse popupFor $No = 001 to 768 $Info = IniRead ( "No.INI", "Number", "$No", "NOEXIST" ) Msgbox(0,0,$No) Msgbox(0,0,$Info) Next (adsbygoogle = window.adsbygoogle || []).push({}); techguy86 Posted November 11, 2004 techguy86 Active Members 73 Posted November 11, 2004 Hi GuysI am having problems with the format of a number. I want to do a look up a ini which has info such as [Number]001=y002=n....056=y..360=netcBasically i want autoit to look up the value in a loop. However the FOR statment go up like 1,2,3,4 where want it to go up like 001,002,003, etchere what i've wroteFor $No = 001 to 768 $Info = IniRead ( "No.INI", "Number", "$No", "NOEXIST" ) Msgbox(0,0,$No) Msgbox(0,0,$Info) Next[post="40760"]<{POST_SNAPBACK}>[/post]Why not 1 instead of 001? My Programs:Dissolve (Updated 5-30-06)Credit Card Validator (Not created as of yet)Master Lock Combination Cracker (Updated 7-08-07)Go Site-Seeing:My Website: - Click Here
Marc Posted November 11, 2004 Posted November 11, 2004 Entrys are read as strings, so just fill it up with zeroes... For $No = 1 to 768 $No_str = $No While StringLen($No_Str)<4 $No_str = "0" & $No_str WEnd $Info = IniRead ( "No.INI", "Number", "$No", "NOEXIST" ) Msgbox(0,0,$No) Msgbox(0,0,$Info) Next cu Marc Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)
SlimShady Posted November 11, 2004 Posted November 11, 2004 There is a StringFormat function which I can't give help you with. But I can help you another way. For $No = 1 to 768 If $No < 10 Then $No = "00" & $No ElseIf $No < 100 Then $No = "0" & $No EndIf $Info = IniRead ( "No.INI", "Number", $No, "NOEXIST") Msgbox(0,0,$No) Msgbox(0,0,$Info) Next
Developers Jos Posted November 11, 2004 Developers Posted November 11, 2004 Basically i want autoit to look up the value in a loop. However the FOR statment go up like 1,2,3,4 where want it to go up like 001,002,003, etc<{POST_SNAPBACK}>For $No = 001 To 768 $Info = IniRead("No.INI", "Number", StringFormat("%03i", $No), "NOEXIST") Msgbox(0,0,$No) Msgbox(0,0,$Info) Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts
Marc
Entrys are read as strings, so just fill it up with zeroes...
cu
Marc
Any of my own codes posted on the forum are free for use by others without any restriction of any kind. (WTFPL)
SlimShady
There is a StringFormat function which I can't give help you with.
But I can help you another way.
Jos
SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules

Live for the present,
Dream of the future,
Learn from the past.