Sign in to follow this  
Followers 0
vickerps

String format

5 posts in this topic

Hi Guys

I 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=y

002=n

....

056=y

..

360=n

etc

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

here what i've wrote

For $No = 001 to 768    $Info = IniRead ( "No.INI", "Number", "$No", "NOEXIST" )    Msgbox(0,0,$No) Msgbox(0,0,$Info)       Next


            
        

        
            
                

    
        
            
        
    


            
        

        
            
                
                
                
            
            
                
            
        
        
    

    
        
            Share this post
            
Link to post
            
            
            

            
                Share on other sites
                

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    

            
        
    


    

                    
                        





(adsbygoogle = window.adsbygoogle || []).push({});




                    
                
                    
                    
                    






    
    
        
techguy86   

    
        
    
             0
    
        
    

        
            
                Wayfarer
            
            

            
                

    
        
    

            
            Active Members
            
            
                

    
        
    
             0
    
        
    

                68 posts
                
                

            
        
    
    
        


    

    
        
            
            
                
            
            
        

        
    #2 · 
            Posted 
            
            
            
        
    

    


            
        
            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 wrote

For $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 Siteseeing:My Website: - Click HereCyberZeroCool's Website - Click Here

Share this post


Link to post
Share on other sites

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


It's my job to comfort the disturbed and to disturb the comfortable.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  
Followers 0