Sign in to follow this  
Followers 0
SmOke_N

Array's | For/Next | .ini Questions

3 posts in this topic

#1 ·  Posted (edited)

I have a script that returns a value like this: 3a,Ba,Rb,Lb,Kc,Ud,2c

I'm trying to seperate them by value: And I can't variate or adjust the letter values, but they will only ever contain the below Letters

the rest will always be numbers from 9 to 2.

B is always highest value

L is Next

R is Next

K is Next

U is Next Then it goes from 9 to 2

Now the script always returns 7 Main Letters or Numbers and 4 Sub Letters (only letters (always the same 4)). I'm just now learning about how to use an .ini and can honestly say that I haven't grasped it as well as maybe I should. And I'm thinking this is the route I will have to take.

Using the .ini would allow me to give each scenerio a value.

[Value1]

Highest=Bc,Lc,Rc,Kc,Uc

Highest=BaLaRaKaUa (can you have two Highest keys in the same "Section"?)

"About 10 sections, and 350 keys to check between them"

[LastValue]

Highest=B

But, I'm not sure how to take the value from the script and match it to the key in the .ini. I'm getting 7 letters or numbers, In the .ini there will only be 5 choices for each key, so there are 21 possible combinations between the 13 characters.

I would think something like:

$value = "3a,Ba,Rb,Lb,Kc,Ud,2c"
$var = IniReadSection("C:\Temp\myfile.ini", "Value1")
If Not @error Then
        For $i = 1 To $var[0][0] 
        If $var[$i][1] = $value Then
        MsgBox(0, "Value1", "You've found the value")
        Endif
        Next
Else
$var = IniReadSection("C:\Temp\myfile.ini", "Value2")
     If Not @error Then
             For $i = 1 To $var[0][0] 
             If $var[$i][1] = $value Then
             MsgBox(0, "Value2", "You've found the value")
             Endif
             Next
      EndIf
EndIf

If I'm even doing this right!

Only 2 out of the 10 sections will rely on the "Lower" case next to the value. 4 lower cases total "c,s,d,h"

I've tried putting them in a For statement and even did an _ArraySort (which worked but it works in alphabetical order, and the results are not alphabetical).

I hope I've explained this well enough, sure does look like a book.

Edit: Had to switch something (Hit submit instead of Preview).

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites



Im not really sure what you are trying to do here cos it is really confusing...

But i presume that there will be a logic behind the output.... Try to find that logic and make an algorithm by separating the $value with stringsplit and proceed with if's or Select....

I think that you can have the same "key" name under one section as long as you use Inireadsection and not plain iniread cos then there would be conflict since you have to give it a specific key to read....One way to check that is to add this line under your first For statement: MsgBox(0,"",var [1][$i] & "=" &var[$i][1]

I dont know if i could be of any help but it is really confuzing....

Share this post


Link to post
Share on other sites

Ugh, I knew I would make it confusing. Sometimes I don't know how to explain things so easily.

I get a result of 3a,Ba,Rb,Lb,Kc,Ud,2c , I did a StringRight("",1) to take out the lower case,

now I'm confused on how to find 3,B,R,L,K,U,2 in the .ini in the order I need.

I want to search the .ini to find the result. But the .ini only has 5 characters like so: B,L,R,K,U.

So: There are 5 characters to be found, but my script returns 7 as it should, after doing the math...

I found that left 21 possible combinations of the original 7 characters to return a 5 character match.

Example:

3a,Ba,Rb,Lb,Kc = Position 12345

3a,Ba,Rb,Lb,Ud = Position 12346

7 numbers returned from script / only 5 numbers for match in .ini = 21 Possible combinations

12345, 12346, 12347, 12356, 12357, 12367, 12456, 12457, 12467, 12567, 13456, 13457, 13467, 13567, 14567

23456, 23457, 23467, 23567, 24567, 34567

This is all the possible combinations I can think of, that the orders can be in. So I'm trying to figure out how to look

at all 21 combinations, go through them 1 by 1 as they check the .ini to see if there is a match. I think I can handle

it from that point.

I should let my kids explain these things, I know what I want to do, just not how to put them in words :whistle:


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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