Jump to content
Sign in to follow this  

Help with For $i = 0 To ...

Recommended Posts

I'm trying to setup a selection at the beginning of a script based on a file. The string might have something like Monday,Friday in it. But I have trouble with this, here's what I have.

    Case StringInStr($inivar[8][1], "Sunday")
        $1 = 2
            Case StringInStr($inivar[8][1], "Monday")
        $2 = 3
            Case StringInStr($inivar[8][1], "Tuesday")
        $3 = 4
            Case StringInStr($inivar[8][1], "Wednesday")
        $4 = 5
            Case StringInStr($inivar[8][1], "Thursday")
        $5 = 6
            Case StringInStr($inivar[8][1], "Friday")
        $6 = 7
            Case StringInStr($inivar[8][1], "Saturday")
        $7 = 8
$dates = _ArrayCreate ($1, $2, $3, $4, $5, $6, $7)

For $i = 1 To $dates
    _GUICtrlListViewSetCheckState ($ListView, $i, 1)

Coming soon....

Share this post

Link to post
Share on other sites

#include <GUIConstants.au3>
#include <GuiListView.au3>
Global Const $Cursor_WAIT = 15
Global Const $Cursor_ARROW = 2

GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF) ; will change background color

$listview = GUICtrlCreateListView("day of the week", 10, 10, 200, 200);,$LVS_SORTDESCENDING)
GUICtrlCreateListViewItem("Sunday", $listview)
GUICtrlCreateListViewItem("Monday", $listview)
GUICtrlCreateListViewItem("Tuesday", $listview)
GUICtrlCreateListViewItem("Wednesday", $listview)
GUICtrlCreateListViewItem("Thursday", $listview)
GUICtrlCreateListViewItem("Friday", $listview)
GUICtrlCreateListViewItem("Saturday", $listview)
Dim $inivar[9][2]
$inivar[8][1] = "Saturday"
_SetDay($listview, $inivar[8][1])

    $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

Func _SetDay(ByRef $lv_days, $t_input)
    Local $found_day = 0, $x
    GUISetCursor($Cursor_WAIT, 1)
    For $x = 0 To _GUICtrlListViewGetItemCount ($lv_days) - 1
        If StringInStr(StringUpper(_GUICtrlListViewGetItemText ($lv_days, $x, 0)), StringUpper($t_input)) Then
            GUICtrlSetState($lv_days, $GUI_FOCUS)
            _GUICtrlListViewSetCheckState ($lv_days, $x)
            $found_day = 1
    GUISetCursor($Cursor_ARROW, 1)
    If Not $found_day Then
        MsgBox(0, "No Match", "Day not found: " & $t_input)
EndFunc  ;==>_SetDay

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs


Don't argue with an idiot; people watching may not be able to tell the difference.


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...