Jump to content
Sign in to follow this  
zvvyt

IniReadSectionNames not returning an array

Recommended Posts

zvvyt

Hello once again!

First of all I must say I'm not sure if I posted this in the correct forum, as this contains a GUI and such, but the problem ain't relevant with the GUI.

I've encountered a little problem with the IniReadSectionNames-function.

I'm making a script w/ a GUI which helps you create a ListView.

At the end you'll be able to save the information in an .ini-file which will be read at the next startup of the script.

What I'm trying to achieve is that the script will read the .ini and check for previously saved functions, and compare them with the functions listed in the ListView.

If a function is listed in the .ini, but not in the ListView the section containing that function will be deleted. If the function is listed in both the .ini and in the ListView it will leave the section be.

When it's done going through the prevously saved functions it will parse through comparing the new functions with the old ones and write the new ones into new sections.

The problem is with the IniReadSectionNames-function when the .ini doesn't contain any sections to read.

In my world I'd like it to still create an array where $array[0] would be equal to 0 if no sections were found.

I hope I made myself understood with this. Following is the script in its whole.

And if anyone happen to have an improvement of any kind I'd be much grateful!

Best regards,

zvvyt

#Include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#include <EditConstants.au3>
#Include <String.au3>

Global $Input_name
$Main_window = GUICreate("Folder checker - Settings",400,300,-1,-1)
$list = GUICtrlCreateListView("Name |Function |Folder(s) to check |Files |Date    ",20,100,360,150)
$Button_new = GUICtrlCreateButton("New",25,260,80,30)
$Button_delete = GUICtrlCreateButton("Delete",115,260,80,30)
$Button_info = GUICtrlCreateButton("Info",205,260,80,30)
$Button_save = GUICtrlCreateButton("Save",295,260,80,30)
$Interval_input = GUICtrlCreateInput("0",285,30,40,22)
GUICtrlSetLimit(-1,4,1)
GUICtrlCreateCombo("ms",340,30,40,30)
GUICtrlSetData(-1,"s|min|h")

GUISetState(@SW_SHOW)

while 1
    $msg = GUIGetMsg()
    switch $msg
        case $GUI_EVENT_CLOSE
            Exit
        case $Button_new
            call("New")
            ConsoleWrite("New function ended"&@crlf)
        case $Button_delete
            call("Delete")
        Case $Button_info
            call("Info")
        case $Button_save
            Call("Save")
    EndSwitch
    if _GUICtrlListView_GetSelectedCount($list) = 0 and GUICtrlGetState($Button_delete) = 80 then
        GUICtrlSetState($Button_delete,$gui_disable)
        GUICtrlSetState($Button_info,$gui_disable)
    EndIf
    if _GUICtrlListView_GetSelectedCount($list) > 0 and GUICtrlGetState($Button_delete) = 144 then
        GUICtrlSetState($Button_delete,$gui_enable)
        GUICtrlSetState($Button_info,$gui_enable)
    EndIf
WEnd
#region "New" part
Func New()
    #region Function selection part
    $Input_name = InputBox("Folder checker - New","Enter a name for the new function"&@crlf&"NOTE! Duplicate or blank names are not allowed","","","","",Default,Default,"",$Main_window)
    if @error = 1 then
        ConsoleWrite("Cancel@Name check"&@crlf)
        Return
    EndIf
    if @error <> 0 then
        ConsoleWrite("ERROR:"&@error&"@Name check")
        Return
    EndIf
    if $Input_name = "" then
        Do
            $Input_name = InputBox("Folder checker - New","Enter a name for the new function"&@crlf&"NOTE! Duplicate or blank names are not allowed","","","","",Default,Default,"",$Main_window)
            if @error = 1 then
                ConsoleWrite("Cancel@Name check"&@crlf)
                Return
            EndIf
            if @error <> 0 then
                ConsoleWrite("ERROR:"&@error&"@Name check")
                Return
            EndIf
        until $Input_name <> ""
    EndIf
    for $1 = 0 to _GUICtrlListView_GetItemCount($list) step +1
        $Name_dublicate_check = _GUICtrlListView_GetItemText($list,$1,0)
        if $Input_name = $Name_dublicate_check Then
            ConsoleWrite("Duplicate names!"&@crlf)
            MsgBox(0,"Folder checker - Error", "Name already in use. Please select a new name")
            $Input_name = ""
            $Name_dublicate_check = ""
            call("New")
            Return
        EndIf
    Next
    ConsoleWrite("Passed namecheck"&@crlf)
    $Select_function = GUICreate("Folder checker - Select a function",200,200,-1,-1,$WS_BORDER,"",$Main_window)
    $Select_function_func1 = GUICtrlCreateRadio("Copy files",30,20,170,30) ;-----------------------------------COPY
    GUICtrlSetTip(-1,"Click the ""?"" for more info")
    $Select_function_func2 = GUICtrlCreateRadio("Move files",30,50,170,30) ;-----------------------------------MOVE
    GUICtrlSetTip(-1,"Click the ""?"" for more info")
    $Select_function_func3 = GUICtrlCreateRadio("Delete files",30,80,170,30) ;---------------------------------DELETE
    GUICtrlSetTip(-1,"Click the ""?"" for more info")
    $Select_function_continue = GUICtrlCreateButton("Continue",15,140,80,30)
    GUICtrlSetState(-1,$gui_disable)
    local $Select_function_continue_disabled = 1
    $Select_function_cancel = GUICtrlCreateButton("Cancel",105,140,80,30)
    GUISetState(@sw_show)
    local $Function_selected = ""
    local $Destinating_folder
    while 1 ;----------------------------------------Select function
        ;if WinActive($Main_window) then WinActivate($Select_function)
        GUISetState(@sw_disable,$Main_window)
        $msg = GUIGetMsg()
        if $Select_function_continue_disabled = 1 and BitXOR(GUICtrlRead($Select_function_func1),GUICtrlRead($Select_function_func2),GUICtrlRead($Select_function_func3)) = $GUI_CHECKED then
            GUICtrlSetState($Select_function_continue,$gui_enable)
            $Select_function_continue_disabled = 0
        EndIf
        switch $msg
            case $Select_function_cancel
                ConsoleWrite("Cancel@Function selection"&@crlf)
                GUISetState(@SW_ENABLE,$Main_window)
                GUIDelete($Select_function)
                WinActivate($Main_window)
                Return
            case $Select_function_continue
                If BitAND(GUICtrlRead($Select_function_func1), $GUI_CHECKED) = $GUI_CHECKED then
                    GUIDelete($Select_function)
                    $Function_selected = "Copy"
                    ;call("NewCopy")
                EndIf
                if BitAND(GUICtrlRead($Select_function_func2), $GUI_CHECKED) = $GUI_CHECKED then
                    GUIDelete($Select_function)
                    $Function_selected = "Move"
                    ;call("NewMove")
                EndIf
                if BitAND(GUICtrlRead($Select_function_func3), $GUI_CHECKED) = $GUI_CHECKED then
                    GUIDelete($Select_function)
                    $Function_selected = "Delete"
                    ;call("NewDelete")
                EndIf
                ;GUISetState(@SW_ENABLE,$Main_window)
                ExitLoop
        EndSwitch
    WEnd
    #endregion End Function selection part
    #region Folder selection part
    ConsoleWrite($Function_selected)
    if $Function_selected = "Delete" then
        $Origin_folder = FileSelectFolder("Select file folder","",1,"",$Main_window)
        if @error = 1 then
            ConsoleWrite("Cancel@Folder selction"&@crlf)
            GUISetState(@SW_ENABLE,$Main_window)
            Return
        EndIf
    Else
        $Origin_folder = FileSelectFolder("Select file origin folder","",1,"",$Main_window)
        if @error = 1 then
            ConsoleWrite("Cancel@Origin folder selction"&@crlf)
            GUISetState(@SW_ENABLE,$Main_window)
            Return
        EndIf
        $Destinating_folder = FileSelectFolder("Select destinating folder","",1,"",$Main_window)
        if @error = 1 then
            ConsoleWrite("Cancel@Destinating folder selction"&@crlf)
            GUISetState(@SW_ENABLE,$Main_window)
            Return
        EndIf
        if $Origin_folder = $Destinating_folder Then
            Do
                MsgBox(0,"Error","Same folder specified. Please chose another folder to copy from/to")
                $Origin_folder = FileSelectFolder("Select file origin folder","",1,"",$Main_window)
            if @error = 1 then
                ConsoleWrite("Cancel@Origin folder selction"&@crlf)
                GUISetState(@SW_ENABLE,$Main_window)
                Return
            EndIf
            $Destinating_folder = FileSelectFolder("Select destinating folder","",1,"",$Main_window)
            if @error = 1 then
                ConsoleWrite("Cancel@Destinating folder selction"&@crlf)
                GUISetState(@SW_ENABLE,$Main_window)
                Return
            EndIf
            until $Origin_folder <> $Destinating_folder
        EndIf
    EndIf
    #endregion End Folder selection part
    #region File selection part

    $Select_files = GUICreate("Folder checker - Select files",200,200,-1,-1,$WS_BORDER,"",$Main_window)
    $All_files = GUICtrlCreateRadio("All files",30,30,170,30)
    $Specific_files = GUICtrlCreateRadio("Specific filetype",30,60,170,30)
    $Filetype_input = GUICtrlCreateInput("",50,100,100,20)
    $Select_files_continue = GUICtrlCreateButton("Continue",15,140,80,30)
    GUICtrlSetState(-1,$gui_disable)
    Local $Select_files_continue_disable = 1
    $Select_files_cancel = GUICtrlCreateButton("Cancel",105,140,80,30)
    GUICtrlSetState($Filetype_input,$gui_disable)
    GUISetState(@sw_show)
    Local $Filetype_input_Dot_checker[4]
    while 1
        $Filetype_input_Space_checker = StringSplit(GUICtrlRead($Filetype_input)," ")
        If $Filetype_input_Space_checker[0] = 2 Then
            $Filetype_input_no_space = StringReplace(GUICtrlRead($Filetype_input)," ","")
            GUICtrlSetData($Filetype_input,$Filetype_input_no_space)
        EndIf
        $Filetype_input_Dot_checker = StringSplit(GUICtrlRead($Filetype_input),".")
        if $Filetype_input_Dot_checker[0] >= 2 Then
            if $Filetype_input_Dot_checker[1] <> "" then
                GUICtrlSetData($Filetype_input,StringReplace(GUICtrlRead($Filetype_input),".","",1))
            EndIf
            if $Filetype_input_Dot_checker[0] = 3 then
                GUICtrlSetData($Filetype_input,_StringReverse(StringReplace(_StringReverse(GUICtrlRead($Filetype_input)),".","",1)))
            EndIf
        EndIf
        GUISetState(@SW_DISABLE,$Main_window)
        if GUICtrlRead($Specific_files) = 1 and GUICtrlRead($Filetype_input) = "" and $Select_files_continue_disable = 0  Then
            GUICtrlSetState($Select_files_continue,$gui_disable)
            $Select_files_continue_disable = 1
        EndIf
        if GUICtrlRead($Specific_files) = 1 and GUICtrlRead($Filetype_input) = "." and $Select_files_continue_disable = 0  Then
            GUICtrlSetState($Select_files_continue,$gui_disable)
            $Select_files_continue_disable = 1
        EndIf
        if GUICtrlRead($All_files) = 1 and $Select_files_continue_disable = 1 Then
            GUICtrlSetState($Select_files_continue,$gui_enable)
            $Select_files_continue_disable = 0
        EndIf
        if GUICtrlRead($Specific_files) = 1 and GUICtrlRead($Filetype_input) <> "" and $Select_files_continue_disable = 1 and GUICtrlRead($Filetype_input) <> "." Then
            GUICtrlSetState($Select_files_continue,$gui_enable)
            $Select_files_continue_disable = 0
        EndIf
        $msg = GUIGetMsg()
        switch $msg
            case $Select_files_cancel
                GUISetState(@SW_ENABLE,$Main_window)
                ConsoleWrite("Cancel@File selection"&@crlf)
                GUIDelete($Select_files)
                Return
            case $Specific_files
                GUICtrlSetState($Filetype_input,$gui_enable)
            case $All_files
                GUICtrlSetState($Filetype_input,$gui_disable)
            case $Select_files_continue
                $Function_date_made_long = @YEAR&@MON&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC
                $Function_date_made = @MDAY&"/"&@MON&" "&@HOUR&":"&@MIN
                if GUICtrlRead($All_files) = $GUI_CHECKED Then
                    if $Function_selected = "Delete" then
                        GUICtrlCreateListViewItem($Input_name&"|"&$Function_selected&"|"&$Origin_folder&"|All|"&$Function_date_made_long,$list)
                    Else
                        GUICtrlCreateListViewItem($Input_name&"|"&$Function_selected&"|"&$Origin_folder&" to "&$Destinating_folder&"|All|"&$Function_date_made_long,$list)
                    EndIf
                    GUIDelete($Select_files)
                    ConsoleWrite("All files"&@crlf)
                EndIf
                if GUICtrlRead($Specific_files) = $GUI_CHECKED and GUICtrlRead($Filetype_input) <> "" then
                    $Filetype_input_Dot_checker = StringSplit(GUICtrlRead($Filetype_input),".")
                    if $Filetype_input_Dot_checker[0] = 1 Then
                        GUICtrlSetData($Filetype_input,"."&GUICtrlRead($Filetype_input))
                    EndIf
                    $Filetype_input = StringLower(GUICtrlRead($Filetype_input))
                    if $Function_selected = "Delete" then
                    GUICtrlCreateListViewItem($Input_name&"|"&$Function_selected&"|"&$Origin_folder&"|"&$Filetype_input&"|"&$Function_date_made_long,$list)
                    Else
                        GUICtrlCreateListViewItem($Input_name&"|"&$Function_selected&"|"&$Origin_folder&" to "&$Destinating_folder&"|"&$Function_date_made_long,$list)
                    EndIf
                    GUIDelete($Select_files)
                    ConsoleWrite("Specific files"&@crlf)
                EndIf
                GUISetState(@SW_ENABLE,$Main_window)
                ExitLoop
        EndSwitch
    WEnd

    #endregion End File selection part
    WinActivate($Main_window)
EndFunc
#endregion

func Delete()
    _GUICtrlListView_DeleteItemsSelected($list)
EndFunc
Func Info()

EndFunc

Func Save() ;-------------------------------------------------------- Trouble starts here! --------------------------------------
    ConsoleWrite("Save initialized"&@CRLF)
    GUICtrlSetState($Button_save,$gui_disable)
    if not FileExists("Settings.ini") Then
        ConsoleWrite("No Settings.ini-file found"&@CRLF)
        IniWrite("Settings.ini","","","")
    Else
        $Save_check_earlier_functions = IniReadSectionNames("Settings.ini")
        if @error then MsgBox(0,"","")
        $Save_check_current_functions = _GUICtrlListView_GetItemCount($list)
        if $Save_check_earlier_functions[0] <> 0 Then
            ConsoleWrite("Earlier functions differ to 0"&@CRLF)
            For $count1 = 1 to $Save_check_earlier_functions[0] step +1
                for $count2 = 1 to $Save_check_current_functions step +1
                    ;ConsoleWrite($Save_check_earlier_functions[$count2]&@CRLF)
                    if  $Save_check_earlier_functions[$count2] = _GUICtrlListView_GetItemText($list,$count1,0) then

                    Else
                        if $count2 = $Save_check_earlier_functions[0] Then IniDelete("Settings.ini",$Save_check_earlier_functions[$count2])
                    EndIf
                Next
            Next
            For $count1 = 1 to $Save_check_current_functions step +1
                for $count2 = 1 to $Save_check_earlier_functions[0] step +1
                    ConsoleWrite(_GUICtrlListView_GetItemText($list,$count2,0)&@CRLF)
                    if _GUICtrlListView_GetItemText($list,$count2,0) = $Save_check_earlier_functions[$count1] Then
                        ExitLoop
                    Else
                        IniWrite("Settings.ini",_GUICtrlListView_GetItemText($list,$count2,0),"Function",_GUICtrlListView_GetItemText($list,$count2,1))
                        IniWrite("Settings.ini",_GUICtrlListView_GetItemText($list,$count2,0),"Folder",_GUICtrlListView_GetItemText($list,$count2,2))
                        IniWrite("Settings.ini",_GUICtrlListView_GetItemText($list,$count2,0),"File",_GUICtrlListView_GetItemText($list,$count2,3))
                        IniWrite("Settings.ini",_GUICtrlListView_GetItemText($list,$count2,0),"Date",_GUICtrlListView_GetItemText($list,$count2,4))
                    EndIf
                Next
            Next
        EndIf
    ;EndIf
    ;ConsoleWrite(_GUICtrlListView_GetItemCount($list)&@CRLF)
    ;ConsoleWrite(_GUICtrlListView_GetItemText($list,0,1)&@CRLF)
    GUICtrlSetState($Button_save,$gui_enable)
    ConsoleWrite("Save finished"&@CRLF)
EndFunc;-------------------------------------------------------- Trouble ends here! --------------------------------------
 

Share this post


Link to post
Share on other sites
Melba23

zvvyt,

I have not looked at the code in detail, but based on this:

In my world I'd like it to still create an array where $array[0] would be equal to 0 if no sections were found

just look for the error return and declare the array in the format you require if it occurs:

#include <Array.au3>

$sIniFile = "Foo.txt" ; Non-existent ini file

Global $aArray = IniReadSectionNames($sIniFile)
; If there were no sections
If @error Then
    ; Declare the array as required
    Global $aArray[1] = [0]
EndIf

; And here it is!
_ArrayDisplay($aArray)
All clear? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
zvvyt

zvvyt,

I have not looked at the code in detail, but based on this:

just look for the error return and declare the array in the format you require if it occurs:

#include <Array.au3>

$sIniFile = "Foo.txt" ; Non-existent ini file

Global $aArray = IniReadSectionNames($sIniFile)
; If there were no sections
If @error Then
    ; Declare the array as required
    Global $aArray[1] = [0]
EndIf

; And here it is!
_ArrayDisplay($aArray)
All clear? :)

M23

 

I actually can't get what you suggested to work with my script =/

I noticed that I had missed the #include <Array.au3> you used which I've now included. But still no cigar.

I could be just me who need a lesson in working with arrays.

If you could have a look at at least the last part of the script (the area marked "Trouble starts here!" and "Trouble ends here!") I would be much grateful.

And thanks for your fast reply!

Share this post


Link to post
Share on other sites
Melba23

zvvyt,

This seems to work when I run it:

Func Save() 
    ConsoleWrite("Save initialized" & @CRLF)
    GUICtrlSetState($Button_save, $gui_disable)

    $Save_check_earlier_functions = IniReadSectionNames("Settings.ini")
    If @error Then
        Local $Save_check_earlier_functions[1] = ["0"]
    EndIf
    $Save_check_current_functions = _GUICtrlListView_GetItemCount($list)

    ; Are there any saved functions to check?
    If $Save_check_earlier_functions[0] <> 0 Then
        ; Loop through the ini and check if sections are in the ListView
        For $count1 = 1 To $Save_check_earlier_functions[0]
            $iIndex = _GUICtrlListView_FindText($list, $Save_check_earlier_functions[$count1])
            ; If not found then delete
            If $iIndex = -1 Then
                IniDelete("Settings.ini", $Save_check_earlier_functions[$count1])
            EndIf
        Next
    EndIf

    ; Are there any items in the ListView?
    If $Save_check_current_functions > 0 Then
        ; Now loop through ListView and see if any functions need to be added
        For $count2 = 0 To $Save_check_current_functions - 1 ; Remember ListView items are 0-indexed
            $iIndex = _ArraySearch($Save_check_earlier_functions, _GUICtrlListView_GetItemText($list, $count2, 0))
            ; If not found then add
            If $iIndex = -1 Then
                IniWrite("Settings.ini", _GUICtrlListView_GetItemText($list, $count2, 0), "Function", _GUICtrlListView_GetItemText($list, $count2, 1))
                IniWrite("Settings.ini", _GUICtrlListView_GetItemText($list, $count2, 0), "Folder", _GUICtrlListView_GetItemText($list, $count2, 2))
                IniWrite("Settings.ini", _GUICtrlListView_GetItemText($list, $count2, 0), "File", _GUICtrlListView_GetItemText($list, $count2, 3))
                IniWrite("Settings.ini", _GUICtrlListView_GetItemText($list, $count2, 0), "Date", _GUICtrlListView_GetItemText($list, $count2, 4))
            EndIf
        Next
    EndIf

    GUICtrlSetState($Button_save, $gui_enable)
    ConsoleWrite("Save finished" & @CRLF)

EndFunc   ;==>Save
Does it work for you as well? :)

M23

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
zvvyt

This seems to work when I run it:

Does it work for you as well? :)

 

I bow to your expertise.

Works like a charm, as always when it comes from you.

I will take a look at this code a couple of times and try to learn as much as possible from it.

And thank you, once more.

Share this post


Link to post
Share on other sites
Melba23

zvvyt,

Glad I could help. :)

M23

  • Like 1

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  

  • Similar Content

    • VollachR
      By VollachR
      Hi,
      I'm looking for a way to take a number value from a Row2 of a 2D array and according to this check if files that appear in rows 3-11 in the array exists.
      For example, if the number in Row2 is 5 I need to check for the files in Row 3-6 only, if it is 6 than rows 3-7 and so on.
      I thought on using a FOR loop but I have very little experience with those.
      Can you suggest the best way to do what I need?
      BTW, the files in Rows 3-11 will usually have blank value for any row above the number in Row2 (e.g. Row2 = 5 so Rows3-6 will have values but 8-11 be empty), The values I need are in Column 1 of the array, the name of the key from the INI file that the array was created from is in Column 0.
      Full Example:
      Row2 of Array:
      Col0 = Games# - Col1 = 5
      Rows3-6
      Col0 = Exe2 - Col1 = Path To File
      Col0 = Exe3 - Col1 = Path To File
      Col0 = Exe4 - Col1 = Path To File
      Col0 = Exe5 - Col1 = Path To File
      I need that if Row2 is 5 to check these above for rows if the file exists, if it was 6 then the next row as well and so on up until number 10 in Row2 as it can't go above 10.
      So basically for whatever number in Row2 from 2-10 need to check 1-9 rows from 3-11 to see if the files in Col1 exists and if any of them don't exist it should call a function that shows an error message.
      I'm pretty sure I have the first line of the for look correct:
      For $i = 1 To $aAIO[2][1] Just not sure how to continue from there, also not sure if $i should be equal 1 or 2.
      Help will be appreciated.
    • FMS
      By FMS
      Hello,
      I'm trying to get data from twitter to an array and so far I found an Twitter UDF whish lookes very intresting but couldn't get it to work.
      It lookes not supported any more(2010) and buggy when i read all te replies.
      More around this subject (autoit and twitter) i couldn't find on this forum.
      Is there sombody who know's a good way to get live data from twitter to an array inside autoit?
      (I kinda doubt that this isn't tackled before)
      In the end I was hoping to get all tweets from date to date from an specific subject inside a 2D array to work whit.
    • AndreasNWWWWW
      By AndreasNWWWWW
      I got a question:  i am trying to run different functions based upon what i select in these radio buttons.(code below)
      it needs to check server 1. then run function 1 or function 2 after what i selected in the checkbox.
      once that function is done it moves to the next one, until it has been trough all 5 
       
      iv'e tried using while loops with different while $i equals to something but then i manualy need to go in and edit the script every time.
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 192, 124) $Server2 = GUICtrlCreateLabel("Server2", 216, 95, 41, 17) $server1 = GUICtrlCreateLabel("Server1", 216, 72, 41, 17) $server4 = GUICtrlCreateLabel("Server4", 216, 144, 41, 17) $server3 = GUICtrlCreateLabel("Server3", 216, 119, 41, 17) $server5 = GUICtrlCreateLabel("Server5", 216, 170, 41, 17) $Start = GUICtrlCreateButton("Start", 240, 248, 147, 25) $Checkbox1 = GUICtrlCreateCheckbox("function1", 288, 72, 97, 17) $Checkbox2 = GUICtrlCreateCheckbox("function2", 392, 72, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("function1", 288, 96, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("function2", 392, 96, 97, 17) $Checkbox5 = GUICtrlCreateCheckbox("function1", 288, 120, 97, 17) $Checkbox6 = GUICtrlCreateCheckbox("function2", 392, 120, 97, 17) $Checkbox7 = GUICtrlCreateCheckbox("function1", 288, 144, 97, 17) $Checkbox8 = GUICtrlCreateCheckbox("function2", 392, 144, 97, 17) $Checkbox9 = GUICtrlCreateCheckbox("function1", 288, 170, 97, 17) $Checkbox10 = GUICtrlCreateCheckbox("function2", 392, 170, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
    • 31290
      By 31290
      Hi everyone, 
      I'm currently writing a script that allow me to list all currently installed software on a computer but some of the are listed in the HKLM64 hive of the registry whereas 95% of all others are in the HKLM "normal" one.
      Thing is, I'd like to combine these two reg key into one single ListView item.
      Here's my code so far, knowing that it's working on both cases (changing to HKLM64 or HKLM short)
      Thanks in advance for the help
      -31290-
    • Iceburg
      By Iceburg
      Hi everyone, I'm at best a noobie.  I have read through the Array helps, and specifically the 2D array help file, and I'm struggling to get my code working.
      I have an array that is read from a file, thats working great.  I'm trying to do some math on the array, so I can find the largest, average, lowest, day over day change %, etc.
      The array read working fine, I get 43 lines, line 0 is 44, and then I get data that looks like
      0519 $10,000
      0520 $10,001
      0521 $10,002
      The data in this array is a single 1D array, breaking it out into 2 columns so I can do the math is what I can get to happen.  
      How do I reference the array to store this data?  Second, how do I assign this data to the appropriate row/column?
      Thanks in advance.
      Dim $all_cash_amounts[UBound($aInput)][2] Dim $max_amount_in_account Dim $min_amount_in_account _FileReadToArray($LC_Check_file_path, $aInput) _ArrayDisplay($aInput) local $date = StringRegExp($aInput[1], "(\d\d\d\d)", 1) local $cash = StringRegExp($aInput[1], "\d+\s(-?[0-9\.\,]+)", 1) ConsoleWrite("Date is: " & $date & @CRLF) For $i = 1 To UBound($aInput)-1     $date = StringRegExp($aInput[$i], "(\d\d\d\d)", 1)     $all_cash_amounts[$i][2] = $date[$i][0], $cash[$i][1]      Next _ArrayDisplay($all_cash_amounts)  
×