Sign in to follow this  
Followers 0
strate

Help Needed With Finding Matching Ini Values

7 posts in this topic

Here is my code so far:

#include 'ExcelCom.au3'

$Box_List_File = 'H:\Box List.xls'

$List_Array = _XLColumnToArray($Box_List_File,1,"A2:A172",1,0); Read Box list into array

For $i = 1 To $List_Array[0]+1
    $Kit_Number     = '131097.xls'
    $s_FilePath     = 'G:\Packaging\Process Sheets\'&$Kit_Number
    $s_i_Sheet      = 1
    $s_i_ExcelValue = $List_Array[$i]
    $s_i_Visible    = 1
    ToolTip($List_Array[$i],1,1)
    If _XLSearch($s_FilePath,$s_i_Sheet,$s_i_ExcelValue,$s_i_Visible) <> 'Nothing' Then
        $Section_Read = IniReadSection ('H:\Kit Box List.INI',$Kit_Number)
        If @error = 1 Then
            IniWrite('H:\Kit Box List.INI',$Kit_Number,1,$List_Array[$i])
        Else
;~          MsgBox(0,'Test', $Section_Read[0][0])
            For $ii = 1 To $Section_Read[0][0]
                If $Section_Read[$ii][0] = $List_Array[$i] Then 
                    $New_Value_Num = $Section_Read[0][0] + 1
                    IniWrite('H:\Kit Box List.INI',$Kit_Number,$New_Value_Num,$List_Array[$i])
                    MsgBox(0,'',$Section_Read[$ii][0] &'  '&$List_Array[$i])
                EndIf
            Next
        EndIf
    EndIf
Next
_XLClose($s_FilePath,0, $s_i_Visible = 0)
I need help with it finding matching values so that it doesn't add to the INI.

$Kit_Number is a file that contains something like a Bill of Materials.

$Box_List_File is a file that contains a list of boxes, duh.

I want it to search $Kit_Number for all of the items in $Box_List if it finds a match it creates/adds to the INI file. Right now though it is adding it regardless as to whether or not it is already in the list. The Key number increments correctly though.


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites



Could do it like this maybe... I didn't do your code, because I don't have time to go through it... but after getting rid of the dupes, you could then run another For/Next loop with the new Array it creates

#include <array.au3>

Dim $Array[11]
$Array[1] = 10
$Array[2] = 2
$Array[3] = 3
$Array[4] = 1
$Array[5] = 4
$Array[6] = 3
$Array[7] = 5
$Array[8] = 6
$Array[9] = 4
$Array[10] = 1

Local $TempStore = ''
For $i = 1 To UBound($Array) - 1
    If Not StringInStr(Chr(01) & $TempStore, Chr(01) & $Array[$i] & Chr(01)) Then
        $TempStore = $TempStore & $Array[$i] & Chr(01)
    EndIf
Next
$TempStore = StringSplit(StringTrimRight($TempStore, 1), Chr(01))

_ArrayDisplay($TempStore, 'All Numbers')


[center]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.[/center]

Share this post


Link to post
Share on other sites

Could do it like this maybe... I didn't do your code, because I don't have time to go through it... but after getting rid of the dupes, you could then run another For/Next loop with the new Array it creates

#include <array.au3>

Dim $Array[11]
$Array[1] = 10
$Array[2] = 2
$Array[3] = 3
$Array[4] = 1
$Array[5] = 4
$Array[6] = 3
$Array[7] = 5
$Array[8] = 6
$Array[9] = 4
$Array[10] = 1

Local $TempStore = ''
For $i = 1 To UBound($Array) - 1
    If Not StringInStr(Chr(01) & $TempStore, Chr(01) & $Array[$i] & Chr(01)) Then
        $TempStore = $TempStore & $Array[$i] & Chr(01)
    EndIf
Next
$TempStore = StringSplit(StringTrimRight($TempStore, 1), Chr(01))

_ArrayDisplay($TempStore, 'All Numbers')
I'm having a hard time with this, I think I'll take a look at it again after I get some work out of the way. Thank you.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

What kind of hard time? Do you not understand it?


[center]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.[/center]

Share this post


Link to post
Share on other sites

What kind of hard time? Do you not understand it?

I don't think so.... I'll take a look at again now. From waht I see is it would read in the array and clean it up allowing only one instance of each value?

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

I don't think so.... I'll take a look at again now. From waht I see is it would read in the array and clean it up allowing only one instance of each value?

Yes... and then creates the New Cleaned Array ($TempArray) with the information you want, that you can parse through looking / writing / displaying / or whatever you want to do with it.

[center]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.[/center]

Share this post


Link to post
Share on other sites

Yes... and then creates the New Cleaned Array ($TempArray) with the information you want, that you can parse through looking / writing / displaying / or whatever you want to do with it.

Thank you very much! Maybe one day I can help others, lol.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

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