Jump to content

table with values for editing


Go to solution Solved by Melba23,

Recommended Posts

can you help with loop code

also a little explanation of the loop if possible

i tried this

$brojredova = _GUICtrlListView_GetItemCount($hListView)
    For $brojda = 1 To $brojredova
    $ukupnoda = _GUICtrlListView_FindInText($hListView, "YES")
    MsgBox(0,"",$ukupnoda)
    Next
Edited by dickjones007
Link to comment
Share on other sites

  • Moderators

dickjones007,

We normally regard 24hrs as a reasonable period to wait before bumping your own thread, not 90 mins. Please remember that while it may be urgent for you, it most certainly is not for anyone else. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

dickjones007,

I would do it like this:

#include <DateTimeConstants.au3>
#include <Timers.au3>
#include <String.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
#include <Array.au3>
#include <File.au3>
#include <GuiMenu.au3>
#include <GuiListView.au3>
#include "GUIListViewEx.au3"
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
;#include "_Date_Time_Convert.au3"
;~ #include "_FindInFile.au3"
#include "RecFileListToArray.au3"
;~ #include <GuiMonthCal.au3>

Global $folder = @ScriptDir & "\Data\", $folderslike = @ScriptDir & "\Slike\", $razlika,$hEdit,$Item = -1, $SubItem = 0,$hDC, $hBrush
Global $workingdir = @WorkingDir ; save

Opt("GUIOnEventMode", 1)
;~ Opt("GuiCloseOnESC", 1)
Opt("TrayIconHide", 1)
Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.
Local $exititem = TrayCreateItem("Exit")
;~ Dim $zivotinja[46] = ["Alligator", "Ant", "Bat", "Bear", "Bee", "Bird", "Bull", "Bulldog", "Butterfly", "Cat", "Chicken", "Cow", "Crab", "Crocodile", "Deer", "Dog", "Donkey", "Duck", "Eagle", "Elephant", "Fish", "Fox", "Frog", "Giraffe", "Gorilla", "Hippo", "Horse", "Insect", "Lion", "Monkey", "Moose", "Mouse", "Owl", "Panda", "Penguin", "Pig", "Rabbit", "Rhino", "Rooster", "Shark", "Sheep", "Snake", "Tiger", "Turkey", "Turtle", "Wolf"]
;~ $imeziv = $zivotinja[Random(0, UBound($zivotinja) - 1, 1)]
TraySetIcon(@ScriptDir & "\Ikone\glavna.ico")
;~ TraySetToolTip("Twister kartice" & @CRLF & "Twisted" & " " & $imeziv)

#region --- CodeWizard generated code Start ---
;SpashImage features: Title=No, Width=900, Height=400, Always On Top
;~ SplashImageOn("", $folderslike & "twisterfun.jpg", "900", "400", "-1", "-1", 1)
;~ Sleep(200)
;~ SplashOff()
#endregion --- CodeWizard generated code Start ---

#region ### GUI section ###
#region MENU
$Form1_1 = GUICreate("Twister record", @DesktopWidth - 50, @DesktopHeight - 100, 25, 25, ($WS_MINIMIZEBOX + $WS_SYSMENU), $WS_EX_STATICEDGE)
GUISetBkColor(0xFFCC66)
Global $size = WinGetPos($Form1_1)

$MenuItem1 = GUICtrlCreateMenu("&Menu")
$MenuItem4 = GUICtrlCreateMenuItem("&New Entry", $MenuItem1)
GUICtrlSetOnEvent($MenuItem4, "svenovo1")
$MenuItem12 = GUICtrlCreateMenuItem("&Open data", $MenuItem1)
GUICtrlSetOnEvent($MenuItem12, "otvori1")
$MenuItem9 = GUICtrlCreateMenuItem("&All data", $MenuItem1)
GUICtrlSetOnEvent($MenuItem9, "izdane1")
$MenuItem13 = GUICtrlCreateMenu("&Checking data")
$MenuItem14 = GUICtrlCreateMenuItem("&Check the time of entry", $MenuItem13)
GUICtrlSetOnEvent($MenuItem14, "provjera1")
$MenuItem15 = GUICtrlCreateMenuItem("&Daily Statistics", $MenuItem13)
GUICtrlSetOnEvent($MenuItem15, "statistika1")
$MenuItem6 = GUICtrlCreateMenu("&Search")
$MenuItem8 = GUICtrlCreateMenuItem("&Search tab", $MenuItem6)
GUICtrlSetOnEvent($MenuItem8, "search1")
$MenuItem7 = GUICtrlCreateMenu("&O programu")
$MenuItem2 = GUICtrlCreateMenuItem("&Autor", $MenuItem7)
GUICtrlSetOnEvent($MenuItem2, "oprogramu1")
$MenuItem3 = GUICtrlCreateMenuItem("---------------", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("Output (Ctrl+Shift+x)", $MenuItem1)
GUICtrlSetOnEvent($MenuItem5, "Exit1")

Local $_AccelTable[1][2] = [["+^x", $MenuItem5]]
GUISetAccelerators($_AccelTable)

$cMenu = GUICtrlCreateMenu(_StringRepeat(" ", 10) & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))
_Timer_SetTimer($Form1_1, 1000, "_UpdateMenuClock"); create timer
#endregion MENU

$default = GUICtrlCreateButton("DEFAULT", 300, 0, 60, 15)
GUICtrlSetOnEvent($default, "default1")
GUICtrlCreateLabel("Djelatnik:", 20, 17, 60, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$employees = GUICtrlCreateCombo("", 100, 13, 119, 25)
GUICtrlSetData($employees, "Anita Tihi|Nikolina Matanovic", "Anita Tihi")
$imeprezime = GUICtrlCreateInput("", 100, 40, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Ime i prezime:", 20, 43, 80, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$datumrod = GUICtrlCreateDate("2001/01/01", 100, 66, 120, 20, $DTS_SHORTDATEFORMAT)
GUICtrlCreateLabel("Date Reward:", 20, 69, 80, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$brojorm = GUICtrlCreateInput("", 100, 40 + 52, 60, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
GUICtrlCreateLabel("number of cabinets", 20, 43 + 52, 75, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
GUICtrlSetLimit($brojorm, 2, 2)
;~ GUICtrlCreateLabel("VRIJEME ULAZA/ExitA", 20, 43 + 78, 175, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ GUICtrlCreateLabel("ULAZ", 20, 153, 45, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ $ulaz = GUICtrlCreateInput("", 70, 150, 50, 20, ($ES_READONLY + $SS_CENTER))
;~ $ulazbutton = GUICtrlCreateButton("UNESI VRIJEME", 130, 150, 90, 21)
;~ GUICtrlSetOnEvent($ulazbutton, "ulaznovrijeme1")
;~ GUICtrlCreateLabel("Exit", 20, 179, 45, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ $Exit = GUICtrlCreateInput("", 70, 176, 50, 20, ($ES_READONLY + $SS_CENTER))
;~ $Exitbutton = GUICtrlCreateButton("UNESI VRIJEME", 130, 176, 90, 21)
;~ GUICtrlSetOnEvent($Exitbutton, "Exitnovrijeme1")

#region KONTAKT INFO
$kontakt = GUICtrlCreateCombo("", 320, 40, 80, 21)
GUICtrlSetData($kontakt, "Majka|Otac|Djed|Baka|Brat|Sestra|Prijatelj|Ocuh|Pomajka|Stric|Strina|Ujak|Ujna|Bratic|Sestricna", "Majka")
GUICtrlCreateLabel("Contact person:", 243, 43, 77, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontaktime = GUICtrlCreateInput("", 470, 40, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Ime:", 410, 43, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontaktel = GUICtrlCreateInput("", 470, 66, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Telefon:", 410, 69, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontakosobn = GUICtrlCreateInput("", 470, 66 + 26, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Br. personally:", 410, 69 + 26, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontakmail = GUICtrlCreateInput("", 470, 66 + 52, 120, 21, $GUI_SS_DEFAULT_INPUT)
GUICtrlCreateLabel("e-mail:", 410, 69 + 52, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$Add = GUICtrlCreateButton("&Add kontakt", 607, 40, 80, 25)
GUICtrlSetOnEvent($Add, "Add1")
$listakontakt = GUICtrlCreateEdit("", 700, 40, 267, 200, BitOR($ES_READONLY, $WS_VSCROLL))
$Delete = GUICtrlCreateButton("Delete kontakte", 607, 80, 80, 25)
GUICtrlSetOnEvent($Delete, "Delete1")
#endregion KONTAKT INFO

$radioplati = GUICtrlCreateRadio("Entrance with payment", 20, 210, 120, 20)
$radiogratis = GUICtrlCreateRadio("Entrance FREE", 20, 230, 120, 20)
GUICtrlSetState($radioplati, $GUI_CHECKED)

$Save = GUICtrlCreateButton("&Save", 160, 220, 75, 40)
GUICtrlSetOnEvent($Save, "Save1")

$Addlist = GUICtrlCreateButton("&Add to ListView", 20, 290, 95, 25)
GUICtrlSetOnEvent($Addlist, "Addlist1")
$listime = GUICtrlCreateInput("test", 20, 320, $size[2]/6, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
$listulaz = GUICtrlCreateInput("33:44", 20+$size[2]/6, 320, $size[2]/8, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
$listExit = GUICtrlCreateInput("11:22", 20+$size[2]/6+$size[2]/8, 320, $size[2]/8, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
$listorm = GUICtrlCreateInput("45", 20+$size[2]/6+$size[2]/8+$size[2]/8, 320, $size[2]/16, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))

$CountGratis = GUICtrlCreateButton("Count gratis", 120, 290, 95, 25) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetOnEvent($CountGratis, "_CountGratis") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

$hListView = _GUICtrlListView_Create($Form1_1, "Name i wintered|Vrijeme ulaska|Vrijeme izlaska|number of cabinets|Paid|GRATIS", 20, 350, $size[2]-45, $size[2]-750, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_GRIDLINES + $LVS_EX_CHECKBOXES)
_GUICtrlListView_SetColumnWidth($hListView,0,$size[2]/6)
_GUICtrlListView_SetColumnWidth($hListView,1,$size[2]/8)
_GUICtrlListView_SetColumnWidth($hListView,2,$size[2]/8)
_GUICtrlListView_SetColumnWidth($hListView,3,$size[2]/16)

; Initialise ListView - set for edit on DblClk
$iLV_Index = _GUIListViewEx_Init($hListView, "", 0, 0, False, 2)

GUISetState()

; Register required handlers
_GUIListViewEx_MsgRegister()

;~ MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
#endregion ### GUI section ###

; *** create these here and not over and over in a function
;~ $pic = GUICtrlCreatePic($folderslike & "backg.jpg", 240, 14 + 150, 364, 228)

While 1
    Switch TrayGetMsg()
        Case $exititem
            ExitLoop
    EndSwitch

    ; Wait for DblClk on ListView to edit
     _GUIListViewEx_EditOnClick()

WEnd

Func _CountGratis() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    $iCount = _GUICtrlListView_GetItemCount($hListView)
    For $i = 0 To $iCount -1
        If _GUICtrlListView_GetItemText($hListView, $i, 5) = "yes" Then
            ConsoleWrite("Item " & $i & " GRATIS" & @CRLF)
        EndIf
    Next

EndFunc

Func Addlist1()
    ; Activate ListView
    _GUIListViewEx_SetActive($iLV_Index)
    ; Create data string
    $sData = GUICtrlRead($listime) & "|" & GUICtrlRead($listulaz) & "|" & GUICtrlRead($listExit) & "|" & GUICtrlRead($listorm)
    ; Add line to ListView
    _GUIListViewEx_Insert($sData)

EndFunc

Func svenovo1() ;put empty values into fields
    GUICtrlSetData($imeprezime, "")
    GUICtrlSetData($kontaktime, "")
    GUICtrlSetData($kontaktel, "")
    GUICtrlSetData($kontakosobn, "")
    GUICtrlSetData($kontakmail, "")
    GUICtrlSetData($brojorm, "")
    GUICtrlSetData($listakontakt, "")
;~  GUICtrlSetData($brojkart, "") ;broj kartice
;~  GUICtrlSetData($listakontakt, "") ;lista kontakata
;~  GUICtrlSetImage($pic, $folderslike & "backg.jpg")
EndFunc   ;==>svenovo1

Func default1() ;put default values into fields
    Dim $aWord[10] = ["Kruno", "Ilija", "Marko", "Filip", "Ivan", "Željka", "Marica", "Matilda", "Ana", "Anita"]
    $ime = $aWord[Random(0, UBound($aWord) - 1, 1)]
    Dim $bWord[10] = ["Majetic", "Krpic", "Markic", "Filipic", "Ivanovic", "Martic", "Klovic", "Zulic", "Ludic", "Varnic"]
    $prezime = $bWord[Random(0, UBound($bWord) - 1, 1)]
    GUICtrlSetData($imeprezime, $ime & " " & $prezime) ;ime prezime
    Dim $cWord[10] = ["Marica", "Barica", "Ivica", "Karlo", "Pera", "Marijana", "Klara", "Maja", "Verica", "Ðuka"]
    $kontime = $cWord[Random(0, UBound($cWord) - 1, 1)]
    GUICtrlSetData($kontaktime, $kontime) ;ime kontakta
    GUICtrlSetData($kontaktel, "035/212-055") ;telefon
    GUICtrlSetData($kontakosobn, "123456789") ;ulicu
    GUICtrlSetData($kontakmail, "mail@mail.com") ;postu
;~  GUICtrlSetData($grad, "SLAVONSKI BROD") ;grad
;~  GUICtrlSetData($vrsta, "Polugodisnja") ;vrsta kartice
    GUICtrlSetData($brojorm, StringFormat("%02u", Random(01, 100, 1))) ;broj kartice
EndFunc   ;==>default1

Func Add1()
    If GUICtrlRead($listakontakt) = "" Then
        GUICtrlSetData($listakontakt, GUICtrlRead($kontakt) & ":" & GUICtrlRead($kontaktime) & @CRLF & "Kontakt broj:" & GUICtrlRead($kontaktel) & @CRLF & "Broj personally iskaznice:" & GUICtrlRead($kontakosobn) & @CRLF & GUICtrlRead($kontakmail), 1)
    Else
        GUICtrlSetData($listakontakt, @CRLF & @CRLF & GUICtrlRead($kontakt) & ":" & GUICtrlRead($kontaktime) & @CRLF & "Kontakt broj:" & GUICtrlRead($kontaktel) & @CRLF & "Broj personally iskaznice:" & GUICtrlRead($kontakosobn) & @CRLF & GUICtrlRead($kontakmail), 1)
    EndIf
EndFunc   ;==>Add1

Func Delete1()
    If GUICtrlRead($listakontakt) = "" Then
        MsgBox(64, "Brisanje kontakt brojeva", "Nema dodanih kontakt brojeva")
    Else
        $return = MsgBox(4 + 32, "Brisanje kontakt brojeva", "Da li sigurno želite obrisati SVE kontakt brojeve?")
        If $return = 6 Then
            GUICtrlSetData($listakontakt, "")
        Else
            Sleep(100)
        EndIf
    EndIf
EndFunc   ;==>Delete1

Func Save1()

    If FileExists($folder) Then
        Sleep(100)
    Else
        DirCreate($folder)
    EndIf

    Global $imeprezimetxt = GUICtrlRead($imeprezime)
    $datumrodtxt = GUICtrlRead($datumrod)
    $kontakteltxt = GUICtrlRead($kontaktel)
;~  $ulaztxt = GUICtrlRead($ulaz)
;~  $Exittxt = GUICtrlRead($Exit)
    If $radioplati And BitAND(GUICtrlRead($radioplati), $GUI_CHECKED) = $GUI_CHECKED Then
        Global $placenotxt = "GOTOVINA"
    Else
        Global $placenotxt = "GRATIS"
    EndIf
    $brojormtxt = StringFormat("%02d", GUICtrlRead($brojorm))
    $employeestxt = GUICtrlRead($employees)
    $vrstatxt = ControlGetText($Form1_1, "", "[CLASS:Edit; INSTANCE:10]")
    $listakontakttxt = GUICtrlRead($listakontakt)
    Global $avArray[10][3] = [["[IME I PREZIME]", $imeprezimetxt],["[DATUM ROÐENJA]", $datumrodtxt],["[number of cabinets]", $brojormtxt], _
            ["[SLOBODNO POLJE]", ""],["[SLOBODNO POLJE]", ""],["[PLACENO ILI GRATIS]", $placenotxt],["[SLOBODNO POLJE]", ""], _
            ["[SLOBODNO POLJE]", ""],["[SLOBODNO POLJE]", ""],["[Contact person]", $listakontakttxt]]
;~  _ArrayDisplay($avArray, "Podatci o korisniku kartice")
    If GUICtrlRead($listakontakt) = "" Then
        $nemakontakt = MsgBox(4 + 64, "Spremanje podataka", "Nema dodanih kontakt brojeva." & @CRLF & "Da li sigurno želite nastaviti sa spremanjem?")
        If $nemakontakt = 6 Then
            filesavedialog1()
        Else
            Sleep(100)
        EndIf
    Else
        filesavedialog1()
    EndIf

EndFunc   ;==>Save1

Func filesavedialog1()
    Local $sStartDate = _NowCalcDate()
    $konvsStartDate = StringSplit($sStartDate, "/")
    Global $novisStartDate = Number($konvsStartDate[3]) & "_" & Number($konvsStartDate[2]) & "_" & StringRight($konvsStartDate[1], 4)
    Local $sStartTime = _NowTime()
    $konvsStartTime = StringSplit($sStartTime, ":")
    $novisStartTime = StringRight($konvsStartTime[1], 2) & "_" & StringRight($konvsStartTime[2], 2) & "_" & StringRight($konvsStartTime[3], 2)
    $sFile = FileSaveDialog("Izaberite ime.", $folder, "Text files (*.txt)", 16, $imeprezimetxt & " _ " & $novisStartDate & " " & $novisStartTime & " _ " & $placenotxt & ".txt")
    If @error Then
        MsgBox(4096, "", "Spremanje otkazano.")
    Else
        _FileWriteFromArray($sFile, $avArray, 0, "", @CRLF)
        FileChangeDir($workingdir)
        svenovo1()
    EndIf
EndFunc   ;==>filesavedialog1

Func izdane1()
    If FileExists($folder) Then
        Sleep(100)
    Else
        DirCreate($folder)
    EndIf
    Run("Explorer.exe " & $folder)
EndFunc   ;==>izdane1

Func provjera1()
    $provjfile = FileOpenDialog("Odaberite datoteku.", $folder, "Text files (*.txt)", 16)
    If @error Then
        MsgBox(4096, "", "Datoteka nije izabrana.")
    Else
        Global $inputulaz = FileReadLine($provjfile, 11)
        If $inputulaz = "" Then
            MsgBox(0, "Vrijeme ulaska u igraonicu", "Vrijeme nije uneseno")
        Else
            razlika_u_provjeri_vremena()
            MsgBox(0, "Vrijeme ulaska u igraonicu", $inputulaz & @CRLF & "Prošlo je " & $razlika & " od ulaska u igraonicu")
        EndIf
    EndIf
    FileClose($provjfile)
EndFunc   ;==>provjera1

Func statistika1()
;~  $danasDate = _NowCalcDate()
;~  $konvdanasDate = StringSplit($danasDate, "/")
;~  $novidanasDate = Number($konvdanasDate[3]) & "_" & Number($konvdanasDate[2]) & "_" & StringRight($konvdanasDate[1], 4)
    $inputdatum = InputBox("Unesite datum", "Obavezan format datuma je npr. 01_01_0001", @MDAY & "_" & @MON & "_" & @YEAR, "", 120, 140)
    GUICtrlSetLimit($inputdatum, 10, 10)
    If @error = 1 Then
        MsgBox(0, "Statistika ulazaka", "Prikaz statistike otkazan")
    Else
        If StringRegExp($inputdatum, "\d{2}_\d{2}_\d{4}") Then ; nece samo 4 broja nego bilo koliko vise
            $datum = _NowCalcDate()
            $konvdatum = StringSplit($datum, "/")
            $novidatuma = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4)
            $statsgotovina = _FileListToArray($folder, "*" & $inputdatum & "*GOTOVINA*", 1)
            $statsgratis = _FileListToArray($folder, "*" & $inputdatum & "*GRATIS*", 1)
            _ArrayDisplay($statsgotovina)
            _ArrayDisplay($statsgratis)
            MsgBox(0, "Statistika ulazaka", "Statistika za dan " & $novidatuma & @CRLF & @CRLF & "Broj ulazaka placenih gotovinom: " & $statsgotovina[0] & @CRLF & "Broj ulazaka GRATIS :" & $statsgratis[0])
        Else
            MsgBox(0, "Statistika ulazaka", "Krivi format datuma")
        EndIf
    EndIf
EndFunc   ;==>statistika1

Func razlika_u_provjeri_vremena()
    Local $sTime1 = $inputulaz, $sTime2 = _NowTime()
    Local $iTime1, $iTime2, $iTime24
    Local $aTemp, $sHour, $sMinute, $sSecond
    $aTemp = StringSplit($sTime1, ":")
    $iTime1 = _TimeToTicks($aTemp[1], $aTemp[2], $aTemp[3])
    $aTemp = StringSplit($sTime2, ":")
    $iTime2 = _TimeToTicks($aTemp[1], $aTemp[2], $aTemp[3])
    _TicksToTime($iTime2 - $iTime1, $sHour, $sMinute, $sSecond)
    If Number(StringReplace($sTime1, ":", "")) < Number(StringReplace($sTime2, ":", "")) Then
        _TicksToTime($iTime2 - $iTime1, $sHour, $sMinute, $sSecond) ; No 24 hr rollover
    Else
        $iTime24 = _TimeToTicks("24", "00", "00") ; 24 hr rollover
        _TicksToTime($iTime2 + $iTime24 - $iTime1, $sHour, $sMinute, $sSecond)
    EndIf
    Global $razlika = StringRight("0" & $sHour, 2) & ":" & StringRight("0" & $sMinute, 2) & ":" & StringRight("0" & $sSecond, 2)
EndFunc   ;==>razlika_u_provjeri_vremena

;~ Func ulaznovrijeme1()
;~  GUICtrlSetData($ulaz, _NowTime())
;~ EndFunc   ;==>ulaznovrijeme1

;~ Func Exitnovrijeme1()
;~  GUICtrlSetData($Exit, _NowTime())
;~ EndFunc   ;==>Exitnovrijeme1

Func oprogramu1()

    MsgBox(0, "Autor", "Darko Majetic" & @CRLF & "darkman@doctor.com")
EndFunc   ;==>oprogramu1

Func search1()
    Global $bezveze, $MenuItem10, $MenuItem11
    If $bezveze = 9999 Then
        $pitanje = MsgBox(4 + 64, "", "Rezultati vaše prethodne pretrage biti ce obrisani." & @CRLF & "Želite li nastaviti dalje?")
        If $pitanje = 6 Then
            GUICtrlDelete($MenuItem10)
            GUICtrlDelete($MenuItem11)
            $searchtext = InputBox("Tekst", "Upisati traženi tekst:" & @CRLF & "(biti ce pretražena mapa" & " " & $folder & ")", "", " M", 500, 140)
            If @error = 1 Then
                Sleep(100)
            Else
                $aArray = _RecFileListToArray($folder, "*" & $searchtext & "*.txt", 1)
                $nadenifile = _ArrayToString($aArray, "", 1)
                $beztxt = StringReplace($nadenifile, ".txt", ".")
                $found = StringSplit($beztxt, ".")
                $MenuItem10 = GUICtrlCreateMenu("<---->", -1, 3)
                $MenuItem11 = GUICtrlCreateMenu("&Pronadene datoteke", -1, 4)
                $iJ = UBound($aArray, 1)
                For $i = 1 To $iJ - 1 ;Loop
                    $nadjeno = GUICtrlCreateMenuItem($found[$i], $MenuItem11)
                    GUICtrlSetOnEvent(Default, '_Menu')
                Next
            EndIf
        Else
            Sleep(88)
        EndIf
    Else
        $searchtext = InputBox("Tekst", "Upisati traženi tekst:" & @CRLF & "(biti ce pretražena mapa" & " " & $folder & ")", "", " M", 500, 140)
        If @error = 1 Then
            Sleep(100)
        Else
            $aArray = _RecFileListToArray($folder, "*" & $searchtext & "*.txt", 1)
            $nadenifile = _ArrayToString($aArray, "", 1)
            $beztxt = StringReplace($nadenifile, ".txt", ".")
            $found = StringSplit($beztxt, ".")
            $MenuItem10 = GUICtrlCreateMenu("<---->", -1, 3)
            $MenuItem11 = GUICtrlCreateMenu("&Pronadene datoteke", -1, 4)
            $iJ = UBound($aArray, 1)
            For $i = 1 To $iJ - 1 ;Loop
                $nadjeno = GUICtrlCreateMenuItem($found[$i], $MenuItem11)
                GUICtrlSetOnEvent(Default, '_Menu')
            Next
            $bezveze = 9999
        EndIf
    EndIf

EndFunc   ;==>search1

Func otvori1()
    $file = FileOpenDialog("Odaberite datoteku.", $folder, "Text files (*.txt)", 16)
    If @error Then
        MsgBox(4096, "", "Datoteka nije izabrana.")
    Else
        svenovo1()
        $inputimeprezime = FileReadLine($file, 2)
        GUICtrlSetData($imeprezime, $inputimeprezime)
        $inputdatumrod = FileReadLine($file, 5)
        $novidatum = 0;_Date_Time_Convert($inputdatumrod, "d/M/yyyy")
        GUICtrlSetData($datumrod, $novidatum)
        $inputbrojorm = FileReadLine($file, 8)
        GUICtrlSetData($brojorm, $inputbrojorm)
        $inputulaz = FileReadLine($file, 11)
;~      GUICtrlSetData($ulaz, $inputulaz)

    EndIf
    FileClose($file)
EndFunc   ;==>otvori1

Func _Menu()
    ; run the found entry
    $datoteka = ShellExecute($folder & GUICtrlRead(@GUI_CtrlId, 1) & ".txt", @SW_MAXIMIZE)
EndFunc   ;==>_Menu

Func _UpdateMenuClock($hWnd, $msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    GUICtrlSetData($cMenu, _StringRepeat(" ", 10) & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))
EndFunc   ;==>_UpdateMenuClock

Func Exit1()
    Exit
EndFunc   ;==>Exit1
Add a few lines to the ListView and edit the GRATIS column to have a few "yes" entries. Then press the "Count gratis" button and the lines with "yes" are written in the SciTE console. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

helps somewhat

im sorry for my newbieness but i cant seem to get the exact number of rows with "yes" value from that

i got to put each number to new row  into editfield and then failed to get each row of editfield into row of array.

can you help some more maybe?

edit: i succeded. by adding number of row to guictrlinput in format of 2 digits and then divided that number by 2.

one way of getting it

Edited by dickjones007
Link to comment
Share on other sites

  • Moderators

dickjones007,

 

i got to put each number to new row into editfield and then failed to get each row of editfield into row of array

What on earth is that supposed to mean? :huh:

You said earlier that:

 

in same list each row will have a "yes" or "no" value in column 5

how can i get the number of rows with "yes" value?

so I have provided you with code that looks for "yes" in column 5 (the one headed "GRATIS"). As I explained in the post above:

 

Add a few lines to the ListView and edit the GRATIS column to have a few "yes" entries. Then press the "Count gratis" button and the lines with "yes" are written in the SciTE console

I do not mind helping in the least, but I do get a tiny bit annoyed when people seem to move the goalposts in mid-thread. How about you explain exactly what you really want (and I certainly do not understand from the comment I quoted above) and then I will try and produce some code that does it. You help me to help you. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

dickjones007,

And that is what I have given you in the code I posted above. Add some lines to the ListView using the "Add to ListView" button, edit some of the "GRATIS" column entries so that they read "yes" (they are all blank when I use the "Add to ListView" button) and then press the "Count gratis" button. The SciTE console will hold details of the rows that contain "yes". Have you actually done that? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

dickjones007,

Try this version:

#include <DateTimeConstants.au3>
#include <Timers.au3>
#include <String.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
#include <Array.au3>
#include <File.au3>
#include <GuiMenu.au3>
#include <GuiListView.au3>
#include "GUIListViewEx.au3"
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <StaticConstants.au3>
;#include "_Date_Time_Convert.au3"
;~ #include "_FindInFile.au3"
#include "RecFileListToArray.au3"
;~ #include <GuiMonthCal.au3>

Global $folder = @ScriptDir & "\Data\", $folderslike = @ScriptDir & "\Slike\", $razlika,$hEdit,$Item = -1, $SubItem = 0,$hDC, $hBrush
Global $workingdir = @WorkingDir ; save

Opt("GUIOnEventMode", 1)
;~ Opt("GuiCloseOnESC", 1)
Opt("TrayIconHide", 1)
Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.
Local $exititem = TrayCreateItem("Exit")
;~ Dim $zivotinja[46] = ["Alligator", "Ant", "Bat", "Bear", "Bee", "Bird", "Bull", "Bulldog", "Butterfly", "Cat", "Chicken", "Cow", "Crab", "Crocodile", "Deer", "Dog", "Donkey", "Duck", "Eagle", "Elephant", "Fish", "Fox", "Frog", "Giraffe", "Gorilla", "Hippo", "Horse", "Insect", "Lion", "Monkey", "Moose", "Mouse", "Owl", "Panda", "Penguin", "Pig", "Rabbit", "Rhino", "Rooster", "Shark", "Sheep", "Snake", "Tiger", "Turkey", "Turtle", "Wolf"]
;~ $imeziv = $zivotinja[Random(0, UBound($zivotinja) - 1, 1)]
TraySetIcon(@ScriptDir & "\Ikone\glavna.ico")
;~ TraySetToolTip("Twister kartice" & @CRLF & "Twisted" & " " & $imeziv)

#region --- CodeWizard generated code Start ---
;SpashImage features: Title=No, Width=900, Height=400, Always On Top
;~ SplashImageOn("", $folderslike & "twisterfun.jpg", "900", "400", "-1", "-1", 1)
;~ Sleep(200)
;~ SplashOff()
#endregion --- CodeWizard generated code Start ---

#region ### GUI section ###
#region MENU
$Form1_1 = GUICreate("Twister record", @DesktopWidth - 50, @DesktopHeight - 100, 25, 25, ($WS_MINIMIZEBOX + $WS_SYSMENU), $WS_EX_STATICEDGE)
GUISetBkColor(0xFFCC66)
Global $size = WinGetPos($Form1_1)

$MenuItem1 = GUICtrlCreateMenu("&Menu")
$MenuItem4 = GUICtrlCreateMenuItem("&New Entry", $MenuItem1)
GUICtrlSetOnEvent($MenuItem4, "svenovo1")
$MenuItem12 = GUICtrlCreateMenuItem("&Open data", $MenuItem1)
GUICtrlSetOnEvent($MenuItem12, "otvori1")
$MenuItem9 = GUICtrlCreateMenuItem("&All data", $MenuItem1)
GUICtrlSetOnEvent($MenuItem9, "izdane1")
$MenuItem13 = GUICtrlCreateMenu("&Checking data")
$MenuItem14 = GUICtrlCreateMenuItem("&Check the time of entry", $MenuItem13)
GUICtrlSetOnEvent($MenuItem14, "provjera1")
$MenuItem15 = GUICtrlCreateMenuItem("&Daily Statistics", $MenuItem13)
GUICtrlSetOnEvent($MenuItem15, "statistika1")
$MenuItem6 = GUICtrlCreateMenu("&Search")
$MenuItem8 = GUICtrlCreateMenuItem("&Search tab", $MenuItem6)
GUICtrlSetOnEvent($MenuItem8, "search1")
$MenuItem7 = GUICtrlCreateMenu("&O programu")
$MenuItem2 = GUICtrlCreateMenuItem("&Autor", $MenuItem7)
GUICtrlSetOnEvent($MenuItem2, "oprogramu1")
$MenuItem3 = GUICtrlCreateMenuItem("---------------", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("Output (Ctrl+Shift+x)", $MenuItem1)
GUICtrlSetOnEvent($MenuItem5, "Exit1")

Local $_AccelTable[1][2] = [["+^x", $MenuItem5]]
GUISetAccelerators($_AccelTable)

$cMenu = GUICtrlCreateMenu(_StringRepeat(" ", 10) & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))
_Timer_SetTimer($Form1_1, 1000, "_UpdateMenuClock"); create timer
#endregion MENU

$default = GUICtrlCreateButton("DEFAULT", 300, 0, 60, 15)
GUICtrlSetOnEvent($default, "default1")
GUICtrlCreateLabel("Djelatnik:", 20, 17, 60, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$employees = GUICtrlCreateCombo("", 100, 13, 119, 25)
GUICtrlSetData($employees, "Anita Tihi|Nikolina Matanovic", "Anita Tihi")
$imeprezime = GUICtrlCreateInput("", 100, 40, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Ime i prezime:", 20, 43, 80, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$datumrod = GUICtrlCreateDate("2001/01/01", 100, 66, 120, 20, $DTS_SHORTDATEFORMAT)
GUICtrlCreateLabel("Date Reward:", 20, 69, 80, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$brojorm = GUICtrlCreateInput("", 100, 40 + 52, 60, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
GUICtrlCreateLabel("number of cabinets", 20, 43 + 52, 75, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
GUICtrlSetLimit($brojorm, 2, 2)
;~ GUICtrlCreateLabel("VRIJEME ULAZA/ExitA", 20, 43 + 78, 175, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ GUICtrlCreateLabel("ULAZ", 20, 153, 45, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ $ulaz = GUICtrlCreateInput("", 70, 150, 50, 20, ($ES_READONLY + $SS_CENTER))
;~ $ulazbutton = GUICtrlCreateButton("UNESI VRIJEME", 130, 150, 90, 21)
;~ GUICtrlSetOnEvent($ulazbutton, "ulaznovrijeme1")
;~ GUICtrlCreateLabel("Exit", 20, 179, 45, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ $Exit = GUICtrlCreateInput("", 70, 176, 50, 20, ($ES_READONLY + $SS_CENTER))
;~ $Exitbutton = GUICtrlCreateButton("UNESI VRIJEME", 130, 176, 90, 21)
;~ GUICtrlSetOnEvent($Exitbutton, "Exitnovrijeme1")

#region KONTAKT INFO
$kontakt = GUICtrlCreateCombo("", 320, 40, 80, 21)
GUICtrlSetData($kontakt, "Majka|Otac|Djed|Baka|Brat|Sestra|Prijatelj|Ocuh|Pomajka|Stric|Strina|Ujak|Ujna|Bratic|Sestricna", "Majka")
GUICtrlCreateLabel("Contact person:", 243, 43, 77, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontaktime = GUICtrlCreateInput("", 470, 40, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Ime:", 410, 43, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontaktel = GUICtrlCreateInput("", 470, 66, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Telefon:", 410, 69, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontakosobn = GUICtrlCreateInput("", 470, 66 + 26, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Br. personally:", 410, 69 + 26, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontakmail = GUICtrlCreateInput("", 470, 66 + 52, 120, 21, $GUI_SS_DEFAULT_INPUT)
GUICtrlCreateLabel("e-mail:", 410, 69 + 52, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$Add = GUICtrlCreateButton("&Add kontakt", 607, 40, 80, 25)
GUICtrlSetOnEvent($Add, "Add1")
$listakontakt = GUICtrlCreateEdit("", 700, 40, 267, 200, BitOR($ES_READONLY, $WS_VSCROLL))
$Delete = GUICtrlCreateButton("Delete kontakte", 607, 80, 80, 25)
GUICtrlSetOnEvent($Delete, "Delete1")
#endregion KONTAKT INFO

$radioplati = GUICtrlCreateRadio("Entrance with payment", 20, 210, 120, 20)
$radiogratis = GUICtrlCreateRadio("Entrance FREE", 20, 230, 120, 20)
GUICtrlSetState($radioplati, $GUI_CHECKED)

$Save = GUICtrlCreateButton("&Save", 160, 220, 75, 40)
GUICtrlSetOnEvent($Save, "Save1")

$Addlist = GUICtrlCreateButton("&Add to ListView", 20, 290, 95, 25)
GUICtrlSetOnEvent($Addlist, "Addlist1")
$listime = GUICtrlCreateInput("test", 20, 320, $size[2]/6, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
$listulaz = GUICtrlCreateInput("33:44", 20+$size[2]/6, 320, $size[2]/8, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
$listExit = GUICtrlCreateInput("11:22", 20+$size[2]/6+$size[2]/8, 320, $size[2]/8, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
$listorm = GUICtrlCreateInput("45", 20+$size[2]/6+$size[2]/8+$size[2]/8, 320, $size[2]/16, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))

$CountGratis = GUICtrlCreateButton("Count gratis", 120, 290, 95, 25) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
GUICtrlSetOnEvent($CountGratis, "_CountGratis") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

$hListView = _GUICtrlListView_Create($Form1_1, "Name i wintered|Vrijeme ulaska|Vrijeme izlaska|number of cabinets|Paid|GRATIS", 20, 350, $size[2]-45, $size[2]-750, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_GRIDLINES + $LVS_EX_CHECKBOXES)
_GUICtrlListView_SetColumnWidth($hListView,0,$size[2]/6)
_GUICtrlListView_SetColumnWidth($hListView,1,$size[2]/8)
_GUICtrlListView_SetColumnWidth($hListView,2,$size[2]/8)
_GUICtrlListView_SetColumnWidth($hListView,3,$size[2]/16)

; Initialise ListView - set for edit on DblClk
$iLV_Index = _GUIListViewEx_Init($hListView, "", 0, 0, False, 2)

GUISetState()

; Register required handlers
_GUIListViewEx_MsgRegister()

;~ MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
#endregion ### GUI section ###

; *** create these here and not over and over in a function
;~ $pic = GUICtrlCreatePic($folderslike & "backg.jpg", 240, 14 + 150, 364, 228)

While 1
    Switch TrayGetMsg()
        Case $exititem
            ExitLoop
    EndSwitch

    ; Wait for DblClk on ListView to edit
     _GUIListViewEx_EditOnClick()

WEnd

Func _CountGratis() ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    Local $iCount = _GUICtrlListView_GetItemCount($hListView)
    Local $iGratis = 0
    For $i = 0 To $iCount -1
        If _GUICtrlListView_GetItemText($hListView, $i, 5) = "yes" Then
            $iGratis += 1
        EndIf
    Next
    MsgBox($MB_SYSTEMMODAL, "GRATIS", "There are " & $iGratis & " items marked 'yes'")

EndFunc

Func Addlist1()
    ; Activate ListView
    _GUIListViewEx_SetActive($iLV_Index)
    ; Create data string
    $sData = GUICtrlRead($listime) & "|" & GUICtrlRead($listulaz) & "|" & GUICtrlRead($listExit) & "|" & GUICtrlRead($listorm)
    ; Add line to ListView
    _GUIListViewEx_Insert($sData)

EndFunc

Func svenovo1() ;put empty values into fields
    GUICtrlSetData($imeprezime, "")
    GUICtrlSetData($kontaktime, "")
    GUICtrlSetData($kontaktel, "")
    GUICtrlSetData($kontakosobn, "")
    GUICtrlSetData($kontakmail, "")
    GUICtrlSetData($brojorm, "")
    GUICtrlSetData($listakontakt, "")
;~  GUICtrlSetData($brojkart, "") ;broj kartice
;~  GUICtrlSetData($listakontakt, "") ;lista kontakata
;~  GUICtrlSetImage($pic, $folderslike & "backg.jpg")
EndFunc   ;==>svenovo1

Func default1() ;put default values into fields
    Dim $aWord[10] = ["Kruno", "Ilija", "Marko", "Filip", "Ivan", "Željka", "Marica", "Matilda", "Ana", "Anita"]
    $ime = $aWord[Random(0, UBound($aWord) - 1, 1)]
    Dim $bWord[10] = ["Majetic", "Krpic", "Markic", "Filipic", "Ivanovic", "Martic", "Klovic", "Zulic", "Ludic", "Varnic"]
    $prezime = $bWord[Random(0, UBound($bWord) - 1, 1)]
    GUICtrlSetData($imeprezime, $ime & " " & $prezime) ;ime prezime
    Dim $cWord[10] = ["Marica", "Barica", "Ivica", "Karlo", "Pera", "Marijana", "Klara", "Maja", "Verica", "Ðuka"]
    $kontime = $cWord[Random(0, UBound($cWord) - 1, 1)]
    GUICtrlSetData($kontaktime, $kontime) ;ime kontakta
    GUICtrlSetData($kontaktel, "035/212-055") ;telefon
    GUICtrlSetData($kontakosobn, "123456789") ;ulicu
    GUICtrlSetData($kontakmail, "mail@mail.com") ;postu
;~  GUICtrlSetData($grad, "SLAVONSKI BROD") ;grad
;~  GUICtrlSetData($vrsta, "Polugodisnja") ;vrsta kartice
    GUICtrlSetData($brojorm, StringFormat("%02u", Random(01, 100, 1))) ;broj kartice
EndFunc   ;==>default1

Func Add1()
    If GUICtrlRead($listakontakt) = "" Then
        GUICtrlSetData($listakontakt, GUICtrlRead($kontakt) & ":" & GUICtrlRead($kontaktime) & @CRLF & "Kontakt broj:" & GUICtrlRead($kontaktel) & @CRLF & "Broj personally iskaznice:" & GUICtrlRead($kontakosobn) & @CRLF & GUICtrlRead($kontakmail), 1)
    Else
        GUICtrlSetData($listakontakt, @CRLF & @CRLF & GUICtrlRead($kontakt) & ":" & GUICtrlRead($kontaktime) & @CRLF & "Kontakt broj:" & GUICtrlRead($kontaktel) & @CRLF & "Broj personally iskaznice:" & GUICtrlRead($kontakosobn) & @CRLF & GUICtrlRead($kontakmail), 1)
    EndIf
EndFunc   ;==>Add1

Func Delete1()
    If GUICtrlRead($listakontakt) = "" Then
        MsgBox(64, "Brisanje kontakt brojeva", "Nema dodanih kontakt brojeva")
    Else
        $return = MsgBox(4 + 32, "Brisanje kontakt brojeva", "Da li sigurno želite obrisati SVE kontakt brojeve?")
        If $return = 6 Then
            GUICtrlSetData($listakontakt, "")
        Else
            Sleep(100)
        EndIf
    EndIf
EndFunc   ;==>Delete1

Func Save1()

    If FileExists($folder) Then
        Sleep(100)
    Else
        DirCreate($folder)
    EndIf

    Global $imeprezimetxt = GUICtrlRead($imeprezime)
    $datumrodtxt = GUICtrlRead($datumrod)
    $kontakteltxt = GUICtrlRead($kontaktel)
;~  $ulaztxt = GUICtrlRead($ulaz)
;~  $Exittxt = GUICtrlRead($Exit)
    If $radioplati And BitAND(GUICtrlRead($radioplati), $GUI_CHECKED) = $GUI_CHECKED Then
        Global $placenotxt = "GOTOVINA"
    Else
        Global $placenotxt = "GRATIS"
    EndIf
    $brojormtxt = StringFormat("%02d", GUICtrlRead($brojorm))
    $employeestxt = GUICtrlRead($employees)
    $vrstatxt = ControlGetText($Form1_1, "", "[CLASS:Edit; INSTANCE:10]")
    $listakontakttxt = GUICtrlRead($listakontakt)
    Global $avArray[10][3] = [["[IME I PREZIME]", $imeprezimetxt],["[DATUM ROÐENJA]", $datumrodtxt],["[number of cabinets]", $brojormtxt], _
            ["[SLOBODNO POLJE]", ""],["[SLOBODNO POLJE]", ""],["[PLACENO ILI GRATIS]", $placenotxt],["[SLOBODNO POLJE]", ""], _
            ["[SLOBODNO POLJE]", ""],["[SLOBODNO POLJE]", ""],["[Contact person]", $listakontakttxt]]
;~  _ArrayDisplay($avArray, "Podatci o korisniku kartice")
    If GUICtrlRead($listakontakt) = "" Then
        $nemakontakt = MsgBox(4 + 64, "Spremanje podataka", "Nema dodanih kontakt brojeva." & @CRLF & "Da li sigurno želite nastaviti sa spremanjem?")
        If $nemakontakt = 6 Then
            filesavedialog1()
        Else
            Sleep(100)
        EndIf
    Else
        filesavedialog1()
    EndIf

EndFunc   ;==>Save1

Func filesavedialog1()
    Local $sStartDate = _NowCalcDate()
    $konvsStartDate = StringSplit($sStartDate, "/")
    Global $novisStartDate = Number($konvsStartDate[3]) & "_" & Number($konvsStartDate[2]) & "_" & StringRight($konvsStartDate[1], 4)
    Local $sStartTime = _NowTime()
    $konvsStartTime = StringSplit($sStartTime, ":")
    $novisStartTime = StringRight($konvsStartTime[1], 2) & "_" & StringRight($konvsStartTime[2], 2) & "_" & StringRight($konvsStartTime[3], 2)
    $sFile = FileSaveDialog("Izaberite ime.", $folder, "Text files (*.txt)", 16, $imeprezimetxt & " _ " & $novisStartDate & " " & $novisStartTime & " _ " & $placenotxt & ".txt")
    If @error Then
        MsgBox(4096, "", "Spremanje otkazano.")
    Else
        _FileWriteFromArray($sFile, $avArray, 0, "", @CRLF)
        FileChangeDir($workingdir)
        svenovo1()
    EndIf
EndFunc   ;==>filesavedialog1

Func izdane1()
    If FileExists($folder) Then
        Sleep(100)
    Else
        DirCreate($folder)
    EndIf
    Run("Explorer.exe " & $folder)
EndFunc   ;==>izdane1

Func provjera1()
    $provjfile = FileOpenDialog("Odaberite datoteku.", $folder, "Text files (*.txt)", 16)
    If @error Then
        MsgBox(4096, "", "Datoteka nije izabrana.")
    Else
        Global $inputulaz = FileReadLine($provjfile, 11)
        If $inputulaz = "" Then
            MsgBox(0, "Vrijeme ulaska u igraonicu", "Vrijeme nije uneseno")
        Else
            razlika_u_provjeri_vremena()
            MsgBox(0, "Vrijeme ulaska u igraonicu", $inputulaz & @CRLF & "Prošlo je " & $razlika & " od ulaska u igraonicu")
        EndIf
    EndIf
    FileClose($provjfile)
EndFunc   ;==>provjera1

Func statistika1()
;~  $danasDate = _NowCalcDate()
;~  $konvdanasDate = StringSplit($danasDate, "/")
;~  $novidanasDate = Number($konvdanasDate[3]) & "_" & Number($konvdanasDate[2]) & "_" & StringRight($konvdanasDate[1], 4)
    $inputdatum = InputBox("Unesite datum", "Obavezan format datuma je npr. 01_01_0001", @MDAY & "_" & @MON & "_" & @YEAR, "", 120, 140)
    GUICtrlSetLimit($inputdatum, 10, 10)
    If @error = 1 Then
        MsgBox(0, "Statistika ulazaka", "Prikaz statistike otkazan")
    Else
        If StringRegExp($inputdatum, "\d{2}_\d{2}_\d{4}") Then ; nece samo 4 broja nego bilo koliko vise
            $datum = _NowCalcDate()
            $konvdatum = StringSplit($datum, "/")
            $novidatuma = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4)
            $statsgotovina = _FileListToArray($folder, "*" & $inputdatum & "*GOTOVINA*", 1)
            $statsgratis = _FileListToArray($folder, "*" & $inputdatum & "*GRATIS*", 1)
            _ArrayDisplay($statsgotovina)
            _ArrayDisplay($statsgratis)
            MsgBox(0, "Statistika ulazaka", "Statistika za dan " & $novidatuma & @CRLF & @CRLF & "Broj ulazaka placenih gotovinom: " & $statsgotovina[0] & @CRLF & "Broj ulazaka GRATIS :" & $statsgratis[0])
        Else
            MsgBox(0, "Statistika ulazaka", "Krivi format datuma")
        EndIf
    EndIf
EndFunc   ;==>statistika1

Func razlika_u_provjeri_vremena()
    Local $sTime1 = $inputulaz, $sTime2 = _NowTime()
    Local $iTime1, $iTime2, $iTime24
    Local $aTemp, $sHour, $sMinute, $sSecond
    $aTemp = StringSplit($sTime1, ":")
    $iTime1 = _TimeToTicks($aTemp[1], $aTemp[2], $aTemp[3])
    $aTemp = StringSplit($sTime2, ":")
    $iTime2 = _TimeToTicks($aTemp[1], $aTemp[2], $aTemp[3])
    _TicksToTime($iTime2 - $iTime1, $sHour, $sMinute, $sSecond)
    If Number(StringReplace($sTime1, ":", "")) < Number(StringReplace($sTime2, ":", "")) Then
        _TicksToTime($iTime2 - $iTime1, $sHour, $sMinute, $sSecond) ; No 24 hr rollover
    Else
        $iTime24 = _TimeToTicks("24", "00", "00") ; 24 hr rollover
        _TicksToTime($iTime2 + $iTime24 - $iTime1, $sHour, $sMinute, $sSecond)
    EndIf
    Global $razlika = StringRight("0" & $sHour, 2) & ":" & StringRight("0" & $sMinute, 2) & ":" & StringRight("0" & $sSecond, 2)
EndFunc   ;==>razlika_u_provjeri_vremena

;~ Func ulaznovrijeme1()
;~  GUICtrlSetData($ulaz, _NowTime())
;~ EndFunc   ;==>ulaznovrijeme1

;~ Func Exitnovrijeme1()
;~  GUICtrlSetData($Exit, _NowTime())
;~ EndFunc   ;==>Exitnovrijeme1

Func oprogramu1()

    MsgBox(0, "Autor", "Darko Majetic" & @CRLF & "darkman@doctor.com")
EndFunc   ;==>oprogramu1

Func search1()
    Global $bezveze, $MenuItem10, $MenuItem11
    If $bezveze = 9999 Then
        $pitanje = MsgBox(4 + 64, "", "Rezultati vaše prethodne pretrage biti ce obrisani." & @CRLF & "Želite li nastaviti dalje?")
        If $pitanje = 6 Then
            GUICtrlDelete($MenuItem10)
            GUICtrlDelete($MenuItem11)
            $searchtext = InputBox("Tekst", "Upisati traženi tekst:" & @CRLF & "(biti ce pretražena mapa" & " " & $folder & ")", "", " M", 500, 140)
            If @error = 1 Then
                Sleep(100)
            Else
                $aArray = _RecFileListToArray($folder, "*" & $searchtext & "*.txt", 1)
                $nadenifile = _ArrayToString($aArray, "", 1)
                $beztxt = StringReplace($nadenifile, ".txt", ".")
                $found = StringSplit($beztxt, ".")
                $MenuItem10 = GUICtrlCreateMenu("<---->", -1, 3)
                $MenuItem11 = GUICtrlCreateMenu("&Pronadene datoteke", -1, 4)
                $iJ = UBound($aArray, 1)
                For $i = 1 To $iJ - 1 ;Loop
                    $nadjeno = GUICtrlCreateMenuItem($found[$i], $MenuItem11)
                    GUICtrlSetOnEvent(Default, '_Menu')
                Next
            EndIf
        Else
            Sleep(88)
        EndIf
    Else
        $searchtext = InputBox("Tekst", "Upisati traženi tekst:" & @CRLF & "(biti ce pretražena mapa" & " " & $folder & ")", "", " M", 500, 140)
        If @error = 1 Then
            Sleep(100)
        Else
            $aArray = _RecFileListToArray($folder, "*" & $searchtext & "*.txt", 1)
            $nadenifile = _ArrayToString($aArray, "", 1)
            $beztxt = StringReplace($nadenifile, ".txt", ".")
            $found = StringSplit($beztxt, ".")
            $MenuItem10 = GUICtrlCreateMenu("<---->", -1, 3)
            $MenuItem11 = GUICtrlCreateMenu("&Pronadene datoteke", -1, 4)
            $iJ = UBound($aArray, 1)
            For $i = 1 To $iJ - 1 ;Loop
                $nadjeno = GUICtrlCreateMenuItem($found[$i], $MenuItem11)
                GUICtrlSetOnEvent(Default, '_Menu')
            Next
            $bezveze = 9999
        EndIf
    EndIf

EndFunc   ;==>search1

Func otvori1()
    $file = FileOpenDialog("Odaberite datoteku.", $folder, "Text files (*.txt)", 16)
    If @error Then
        MsgBox(4096, "", "Datoteka nije izabrana.")
    Else
        svenovo1()
        $inputimeprezime = FileReadLine($file, 2)
        GUICtrlSetData($imeprezime, $inputimeprezime)
        $inputdatumrod = FileReadLine($file, 5)
        $novidatum = 0;_Date_Time_Convert($inputdatumrod, "d/M/yyyy")
        GUICtrlSetData($datumrod, $novidatum)
        $inputbrojorm = FileReadLine($file, 8)
        GUICtrlSetData($brojorm, $inputbrojorm)
        $inputulaz = FileReadLine($file, 11)
;~      GUICtrlSetData($ulaz, $inputulaz)

    EndIf
    FileClose($file)
EndFunc   ;==>otvori1

Func _Menu()
    ; run the found entry
    $datoteka = ShellExecute($folder & GUICtrlRead(@GUI_CtrlId, 1) & ".txt", @SW_MAXIMIZE)
EndFunc   ;==>_Menu

Func _UpdateMenuClock($hWnd, $msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    GUICtrlSetData($cMenu, _StringRepeat(" ", 10) & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))
EndFunc   ;==>_UpdateMenuClock

Func Exit1()
    Exit
EndFunc   ;==>Exit1
Is that what you want? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

dickjones007,

Glad we got there in the end. :)

Are you happy with how the various sections of code I have been providing work? Please do ask if you have any questions about them. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

ok one (stupid) question about:

$iGratis += 1

i know what it does but why +=

 

also further help on my script

i am having difficulty with _GUICtrlListView_SimpleSort

it doesn do it for me

could u please implement it into my script if possible?

my latest script looks like this:

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Ikone\glavna.ico
#AutoIt3Wrapper_Outfile=twister evidencija.exe
#AutoIt3Wrapper_Res_Fileversion=0.5.0.10
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Run_Tidy=y
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
; *** Start added by AutoIt3Wrapper ***
#include <ListViewConstants.au3>
; *** End added by AutoIt3Wrapper ***
#include <DateTimeConstants.au3>
#include <Timers.au3>
#include <String.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <Date.au3>
#include <Array.au3>
#include <File.au3>
#include <GuiMenu.au3>
#include <GuiListView.au3>
#include "GUIListViewEx.au3"
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <GuiComboBox.au3>
#include "_GUICtrlListView_SaveHTML.au3"
#include "IniToArray.au3"
#include "RecFileListToArray.au3"

Global $folder = @ScriptDir & "\Data\", $inifolder = @ScriptDir & "\Ini\", $folderslike = @ScriptDir & "\Slike\", $razlika, $novidatumrod, $line = FileReadLine($inifolder & "baza imena.txt", 1)
Local $workingdir = @WorkingDir ; save
Opt("GUIOnEventMode", 1)
;~ Opt("GuiCloseOnESC", 1)
Opt("TrayIconHide", 1)
Opt("TrayMenuMode", 1) ; Default tray menu items (Script Paused/Exit) will not be shown.
Local $exititem = TrayCreateItem("Izlaz")
;~ Dim $zivotinja[46] = ["Alligator", "Ant", "Bat", "Bear", "Bee", "Bird", "Bull", "Bulldog", "Butterfly", "Cat", "Chicken", "Cow", "Crab", "Crocodile", "Deer", "Dog", "Donkey", "Duck", "Eagle", "Elephant", "Fish", "Fox", "Frog", "Giraffe", "Gorilla", "Hippo", "Horse", "Insect", "Lion", "Monkey", "Moose", "Mouse", "Owl", "Panda", "Penguin", "Pig", "Rabbit", "Rhino", "Rooster", "Shark", "Sheep", "Snake", "Tiger", "Turkey", "Turtle", "Wolf"]
;~ $imeziv = $zivotinja[Random(0, UBound($zivotinja) - 1, 1)]
TraySetIcon(@ScriptDir & "\Ikone\glavna.ico")
;~ TraySetToolTip("Twister kartice" & @CRLF & "Twisted" & " " & $imeziv)

#region --- CodeWizard generated code Start ---
;SpashImage features: Title=No, Width=900, Height=400, Always On Top
;~ SplashImageOn("", $folderslike & "twisterfun.jpg", "900", "400", "-1", "-1", 1)
;~ Sleep(200)
;~ SplashOff()
#endregion --- CodeWizard generated code Start ---

#region ### GUI section ###
#region MENU
$Form1_1 = GUICreate("Twister evidencija", @DesktopWidth - 50, @DesktopHeight - 100, 25, 25, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU))
GUISetBkColor(0xFFCC66)
Global $size = WinGetPos($Form1_1)
$MenuItem1 = GUICtrlCreateMenu("&Izbornik")
$MenuItem4 = GUICtrlCreateMenuItem("&Novi unos", $MenuItem1)
GUICtrlSetOnEvent($MenuItem4, "svenovo1")
$MenuItem12 = GUICtrlCreateMenuItem("&Otvori podatke", $MenuItem1)
GUICtrlSetOnEvent($MenuItem12, "otvori1")
$MenuItem9 = GUICtrlCreateMenuItem("&Svi podatci", $MenuItem1)
GUICtrlSetOnEvent($MenuItem9, "izdane1")
;~ $MenuItem13 = GUICtrlCreateMenu("&Provjera podataka")
;~ $MenuItem14 = GUICtrlCreateMenuItem("&Provjeri vrijeme ulaza", $MenuItem13)
;~ GUICtrlSetOnEvent($MenuItem14, "provjera1")
;~ $MenuItem15 = GUICtrlCreateMenuItem("&Dnevna statistika", $MenuItem13)
;~ GUICtrlSetOnEvent($MenuItem15, "statistika1")
$MenuItem6 = GUICtrlCreateMenu("&Traži")
$MenuItem8 = GUICtrlCreateMenuItem("&Traži karticu", $MenuItem6)
GUICtrlSetOnEvent($MenuItem8, "search1")
$MenuItem7 = GUICtrlCreateMenu("&O programu")
$MenuItem2 = GUICtrlCreateMenuItem("&Feedback", $MenuItem7)
GUICtrlSetOnEvent($MenuItem2, "oprogramu1")
$MenuItem3 = GUICtrlCreateMenuItem("---------------", $MenuItem1)
$MenuItem5 = GUICtrlCreateMenuItem("I&zlaz (Ctrl+Shift+x)", $MenuItem1)
GUICtrlSetOnEvent($MenuItem5, "izlaz1")
Local $_AccelTable[1][2] = [["+^x", $MenuItem5]]
GUISetAccelerators($_AccelTable)
$cMenu = GUICtrlCreateMenu(_StringRepeat(" ", 10) & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))
_Timer_SetTimer($Form1_1, 1000, "_UpdateMenuClock"); create timer
#endregion MENU
$default = GUICtrlCreateButton("DEFAULT", 300, 0, 60, 15)
GUICtrlSetOnEvent($default, "default1")
;~ GUICtrlCreateLabel("Djelatnik:", 20, 17, 60, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ $djelatnici = GUICtrlCreateCombo("", 100, 13, 119, 25)
;~ GUICtrlSetData($djelatnici, "Anita Tihi|Nikolina Matanovic", "Anita Tihi")
$imeprezime = GUICtrlCreateInput("", 100, 40, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Ime i prezime:", 20, 43, 80, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$datumrod = GUICtrlCreateDate("2001/01/01", 100, 66, 120, 20, $DTS_SHORTDATEFORMAT)
GUICtrlCreateLabel("Datum rodenja:", 20, 69, 80, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ $brojorm = GUICtrlCreateInput("", 100, 40 + 52, 60, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_NUMBER))
;~ GUICtrlCreateLabel("Broj ormarica", 20, 43 + 52, 75, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ GUICtrlSetLimit($brojorm, 2, 2)

#region KONTAKT INFO
$kontakt = GUICtrlCreateCombo("", 320, 40, 80, 21)
GUICtrlSetData($kontakt, "Majka|Otac|Djed|Baka|Brat|Sestra|Prijatelj|Ocuh|Pomajka|Stric|Strina|Ujak|Ujna|Bratic|Sestricna", "Majka")
GUICtrlCreateLabel("Kontakt osoba:", 243, 43, 77, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontaktime = GUICtrlCreateInput("", 470, 40, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Ime:", 410, 43, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontaktel = GUICtrlCreateInput("", 470, 66, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Telefon:", 410, 69, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontakosobn = GUICtrlCreateInput("", 470, 66 + 26, 120, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Br. osobne:", 410, 69 + 26, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$kontakmail = GUICtrlCreateInput("", 470, 66 + 52, 120, 21, $GUI_SS_DEFAULT_INPUT)
GUICtrlCreateLabel("e-mail:", 410, 69 + 52, 55, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
$dodaj = GUICtrlCreateButton("Dodaj kontakt", 607, 40, 80, 25)
GUICtrlSetOnEvent($dodaj, "dodaj1")
$listakontakt = GUICtrlCreateEdit("", 700, 40, 267, 200, BitOR($ES_READONLY, $WS_VSCROLL))
$obrisi = GUICtrlCreateButton("Obriši kontakte", 607, 80, 80, 25)
GUICtrlSetOnEvent($obrisi, "obrisi1")
#endregion KONTAKT INFO
$spremi = GUICtrlCreateButton("Spremi podatke", 20, 150, 200, 60)
GUICtrlSetOnEvent($spremi, "spremi1")

$listime = GUICtrlCreateCombo("", 20, 320, $size[2] / 6, 21, $CBS_UPPERCASE)
GUICtrlSetData($listime, $line)
GUICtrlCreateLabel("Ime i prezime:", 20, 300, $size[2] / 6, 19)
$ulazbutton = GUICtrlCreateButton("UNESI VRIJEME ULASKA", 20 + $size[2] / 6, 299, $size[2] / 8, 21)
GUICtrlSetOnEvent($ulazbutton, "ulaznovrijeme1")
$listulaz = GUICtrlCreateInput("", 20 + $size[2] / 6, 320, $size[2] / 8, 21, $ES_READONLY)
$listorm = GUICtrlCreateInput("", 20 + $size[2] / 6 + $size[2] / 8 + $size[2] / 8, 320, $size[2] / 16, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_UPPERCASE))
GUICtrlCreateLabel("Broj ormarica:", 20 + $size[2] / 6 + $size[2] / 8 + $size[2] / 8, 300, $size[2] / 16, 19)
GUICtrlSetLimit($listorm, 2, 2)

$gratisda = GUICtrlCreateRadio("DA", 20 + $size[2] / 6 + $size[2] / 8 + $size[2] / 8 + $size[2] / 16 + 15, 312, 40, 20)
$gratisne = GUICtrlCreateRadio("NE", 20 + $size[2] / 6 + $size[2] / 8 + $size[2] / 8 + $size[2] / 16 + 15, 330, 40, 20)
GUICtrlSetState($gratisne, $GUI_CHECKED)

$dodajlist = GUICtrlCreateButton("Dodaj u tablicu", 20 + $size[2] / 6 + $size[2] / 8 + $size[2] / 8 + $size[2] / 16 * 2, 320, $size[2] / 12, 21)
GUICtrlSetOnEvent($dodajlist, "dodajlist1")
$obrisilist = GUICtrlCreateButton("Obriši oznaceno", 20 + $size[2] / 6 + $size[2] / 8 + $size[2] / 8 + $size[2] / 16 * 2 + $size[2] / 12, 320, $size[2] / 12, 21)
GUICtrlSetOnEvent($obrisilist, "obrisilist1")
$spremilist = GUICtrlCreateButton("Spremi tablicu u HTML format", $size[2] - 205, 320, 180, 21)
GUICtrlSetOnEvent($spremilist, "spremilist1")
$hListView = _GUICtrlListView_Create($Form1_1, "Ime i prezime|Vrijeme ulaska|Vrijeme izlaska|Broj ormarica|GRATIS", 20, 350, $size[2] - 45, $size[3] - 350 - 60, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES))
$B_DESCENDING = _GUICtrlListView_GetColumnCount($hListView);<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<PROBLEMS HERE. DOESNT WORK
$something = "True";<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<PROBLEMS HERE. DOESNT WORK
$column = "1";<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<PROBLEMS HERE. DOESNT WORK
_GUICtrlListView_SimpleSort($hListView, $something, $column);<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<PROBLEMS HERE. DOESNT WORK
_GUICtrlListView_SetColumnWidth($hListView, 0, $size[2] / 6)
_GUICtrlListView_SetColumnWidth($hListView, 1, $size[2] / 8)
_GUICtrlListView_SetColumnWidth($hListView, 2, $size[2] / 8)
_GUICtrlListView_SetColumnWidth($hListView, 3, $size[2] / 16)
; Initialise ListView - set for edit on DblClk
$iLV_Index = _GUIListViewEx_Init($hListView, "", 0, 0, False, 2)
GUISetState()
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
; Register required handlers
_GUIListViewEx_MsgRegister()
;~ MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
#endregion ### GUI section ###

; *** create these here and not over and over in a function
;~ $pic = GUICtrlCreatePic($folderslike & "backg.jpg", 240, 14 + 150, 364, 228)


; kod exit staviti pitanje jeste sigurni i snimati tablicu u toku i staviti obavjest da se snima dok se radi




While 1
    Local $msg = TrayGetMsg()
    If $msg = $exititem Then ExitLoop
    ; Wait for DblClk on ListView to edit
    _GUIListViewEx_EditOnClick()
WEnd

Func dodajlist1()
    If FileExists($inifolder) Then
        Sleep(100)
    Else
        DirCreate($inifolder)
    EndIf

    $IniNameFile = $inifolder & @MDAY & "_" & @MON & "_" & @YEAR & " backup dnevna tablica.ini"

    If $gratisne And BitAND(GUICtrlRead($gratisne), $GUI_CHECKED) = $GUI_CHECKED Then
        Global $listgratis = "NE"
    Else
        Global $listgratis = "DA"
    EndIf

    ; Activate ListView
    _GUIListViewEx_SetActive($iLV_Index)
    ; Create data string
    $sData = GUICtrlRead($listime) & "|" & GUICtrlRead($listulaz) & "|" & "" & "|" & GUICtrlRead($listorm) & "|" & $listgratis
    ; Add line to ListView
    _GUIListViewEx_Insert($sData)
    $aLV_Array = _GUIListViewEx_ReturnArray($iLV_Index)
    _arrayToIni($IniNameFile, "backup tablica", $aLV_Array)
    $imena = FileOpen($inifolder & "baza imena.txt", 1)
    FileWrite($imena, "|" & GUICtrlRead($listime))
    FileClose($imena)
;~  $procitajfile = FileRead($imena)
    $line = FileReadLine($inifolder & "baza imena.txt", 1)
;~  MsgBox(0, "", $line)
    GUICtrlSetData($listime, $line)
    ; Just for display <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;~  Local $aLV_Array = _GUIListViewEx_ReturnArray($iLV_Index) ; Get current content
;~     _ArrayDisplay($aLV_Array) ; Display it
EndFunc   ;==>dodajlist1

Func obrisilist1()
    _GUIListViewEx_Delete()
EndFunc   ;==>obrisilist1

Func spremilist1()
    $lista = _GUIListViewEx_ReadToArray($hListView)
    $danasdatum = _NowCalcDate()
    $konvdanasdatum = StringSplit($danasdatum, "/")
    $novidanasdatum = Number($konvdanasdatum[3]) & "_" & Number($konvdanasdatum[2]) & "_" & StringRight($konvdanasdatum[1], 4)
    $brojredova = _GUICtrlListView_GetItemCount($hListView)
    $iGratis = 0
    For $brojda = 0 To $brojredova - 1
        If _GUICtrlListView_GetItemText($hListView, $brojda & ",", 4) = "DA" Then
            $iGratis += 1
        EndIf
    Next
    _GUICtrlListView_SaveHTML($hListView, $folder & $novidanasdatum & ".html")
EndFunc   ;==>spremilist1

Func svenovo1() ;put empty values into fields
    GUICtrlSetData($imeprezime, "")
    GUICtrlSetData($kontaktime, "")
    GUICtrlSetData($kontaktel, "")
    GUICtrlSetData($kontakosobn, "")
    GUICtrlSetData($kontakmail, "")
    GUICtrlSetData($listakontakt, "")
EndFunc   ;==>svenovo1

Func default1() ;put default values into fields
    Dim $aWord[10] = ["Kruno", "Ilija", "Marko", "Filip", "Ivan", "Željka", "Marica", "Matilda", "Ana", "Anita"]
    $ime = $aWord[Random(0, UBound($aWord) - 1, 1)]
    Dim $bWord[10] = ["Majetic", "Krpic", "Markic", "Filipic", "Ivanovic", "Martic", "Klovic", "Zulic", "Ludic", "Varnic"]
    $prezime = $bWord[Random(0, UBound($bWord) - 1, 1)]
    GUICtrlSetData($imeprezime, $ime & " " & $prezime) ;ime prezime
    GUICtrlSetData($listime, $ime & " " & $prezime)
    Dim $cWord[10] = ["Marica", "Barica", "Ivica", "Karlo", "Pera", "Marijana", "Klara", "Maja", "Verica", "Ðuka"]
    $kontime = $cWord[Random(0, UBound($cWord) - 1, 1)]
    $testdatum = StringFormat("%04u", Random(1999, 2007, 1)) & "/" & StringFormat("%02u", Random(1, 12, 1)) & "/" & StringFormat("%02u", Random(1, 28, 1))
    GUICtrlSetData($datumrod, $testdatum) ;ime kontakta
    GUICtrlSetData($kontaktime, $kontime) ;ime kontakta
    GUICtrlSetData($kontaktel, "035/212-055") ;telefon
    GUICtrlSetData($kontakosobn, "123456789") ;ulicu
    GUICtrlSetData($kontakmail, "mail@mail.com") ;postu
    GUICtrlSetData($listorm, StringFormat("%02u", Random(01, 100, 1)))
    GUICtrlSetData($listulaz, StringFormat("%02u", Random(09, 15, 1)) & ":" & StringFormat("%02u", Random(01, 30, 1)))

EndFunc   ;==>default1

Func dodaj1()
    If GUICtrlRead($listakontakt) = "" Then
        GUICtrlSetData($listakontakt, GUICtrlRead($kontakt) & ": " & GUICtrlRead($kontaktime) & @CRLF & "Kontakt broj: " & GUICtrlRead($kontaktel) & @CRLF & "Broj osobne iskaznice: " & GUICtrlRead($kontakosobn) & @CRLF & "e-mail: " & GUICtrlRead($kontakmail) & @CRLF & "------: ------", 1)
    Else
        GUICtrlSetData($listakontakt, @CRLF & GUICtrlRead($kontakt) & ": " & GUICtrlRead($kontaktime) & @CRLF & "Kontakt broj: " & GUICtrlRead($kontaktel) & @CRLF & "Broj osobne iskaznice: " & GUICtrlRead($kontakosobn) & @CRLF & "e-mail: " & GUICtrlRead($kontakmail) & @CRLF & "------: ------", 1)
    EndIf
EndFunc   ;==>dodaj1

Func obrisi1()
    If GUICtrlRead($listakontakt) = "" Then
        MsgBox(64, "Brisanje kontakt brojeva", "Nema dodanih kontakt brojeva")
    Else
        $return = MsgBox(4 + 32, "Brisanje kontakt brojeva", "Da li sigurno želite obrisati SVE kontakt brojeve?")
        If $return = 6 Then
            GUICtrlSetData($listakontakt, "")
        Else
            Sleep(100)
        EndIf
    EndIf
EndFunc   ;==>obrisi1

Func spremi1()
    If FileExists($folder) Then
        Sleep(100)
    Else
        DirCreate($folder)
    EndIf
    Global $imeprezimetxt = GUICtrlRead($imeprezime)
    Global $datumrodtxt = GUICtrlRead($datumrod)
    $konvdatumrod = StringSplit($datumrodtxt, ".")
    $novidatumrod = Number($konvdatumrod[1]) & "_" & Number($konvdatumrod[2]) & "_" & StringRight($konvdatumrod[3], 4)
    Global $kontakteltxt = GUICtrlRead($kontaktel)
    If $gratisne And BitAND(GUICtrlRead($gratisne), $GUI_CHECKED) = $GUI_CHECKED Then
        $placenotxt = "GOTOVINA"
    Else
        $placenotxt = "GRATIS"
    EndIf
    $brojormtxt = StringFormat("%02d", GUICtrlRead($listorm))
    $vrstatxt = ControlGetText($Form1_1, "", "[CLASS:Edit; INSTANCE:10]")
    Global $listakontakttxt = GUICtrlRead($listakontakt)
    Global $avArray[3][3] = [["[IME I PREZIME]", $imeprezimetxt],["[DATUM ROÐENJA]", $datumrodtxt],["[KONTAKTI]", $listakontakttxt]]
    If GUICtrlRead($listakontakt) = "" Then
        $nemakontakt = MsgBox(4 + 64, "Spremanje podataka", "Nema dodanih kontakt brojeva." & @CRLF & "Da li sigurno želite nastaviti sa spremanjem?")
        If $nemakontakt = 6 Then
            filesavedialog1()
        Else
            MsgBox(4096, "", "Spremanje otkazano.")
        EndIf
    Else
        filesavedialog1()
    EndIf
EndFunc   ;==>spremi1

Func otvori1()
    $openfile = FileOpenDialog("Odaberite datoteku.", $folder, "Text files (*.txt)", 16)
    If @error Then
        MsgBox(4096, "", "Datoteka nije izabrana.")
    Else
        svenovo1()
        GUICtrlSetData($imeprezime, IniRead($openfile, "Podatci o djetetu", "Ime i prezime", ""))
        $novidatum = IniRead($openfile, "Podatci o djetetu", "Datum rodenja", "")
        $konvnovidatum = StringSplit($novidatum, ".")
        $novidatumx = StringRight($konvnovidatum[3], 4) & "/" & StringFormat("%02d", Number($konvnovidatum[2])) & "/" & StringFormat("%02d", Number($konvnovidatum[1]))
;~      MsgBox(0, "", $novidatumx)
        GUICtrlSetData($datumrod, $novidatumx)
        $var = IniReadSection($openfile, "Kontakt podatci")
        If @error Then
            MsgBox(4096, "", "Greška, vjerovatno TXT datoteka nije u ispravnom formatu.")
        Else
            For $i = 1 To $var[0][0]
                GUICtrlSetData($listakontakt, $var[$i][0] & "=" & $var[$i][1] & @CRLF, 1)
            Next
        EndIf

    EndIf
    FileClose($openfile)
EndFunc   ;==>otvori1

Func filesavedialog1()
    $listakontaktrep = StringReplace(GUICtrlRead($listakontakt), ": ", "=")
    $sFile = FileSaveDialog("Izaberite ime.", $folder, "Text files (*.txt)", 16, $imeprezimetxt & " " & $novidatumrod & "_.txt")
    IniWrite($sFile, "Podatci o djetetu", "Ime i prezime", $imeprezimetxt)
    IniWrite($sFile, "Podatci o djetetu", "Datum rodenja", $datumrodtxt)
    IniWriteSection($sFile, "Kontakt podatci", $listakontaktrep)
EndFunc   ;==>filesavedialog1

Func izdane1()
    If FileExists($folder) Then
        Sleep(100)
    Else
        DirCreate($folder)
    EndIf
    Run("Explorer.exe " & $folder)
EndFunc   ;==>izdane1

Func provjera1()
    $provjfile = FileOpenDialog("Odaberite datoteku.", $folder, "Text files (*.txt)", 16)
    If @error Then
        MsgBox(4096, "", "Datoteka nije izabrana.")
    Else
        Global $inputulaz = FileReadLine($provjfile, 11)
        If $inputulaz = "" Then
            MsgBox(0, "Vrijeme ulaska u igraonicu", "Vrijeme nije uneseno")
        Else
            razlika_u_provjeri_vremena()
            MsgBox(0, "Vrijeme ulaska u igraonicu", $inputulaz & @CRLF & "Prošlo je " & $razlika & " od ulaska u igraonicu")
        EndIf
    EndIf
    FileClose($provjfile)
EndFunc   ;==>provjera1

Func statistika1()
    $inputdatum = InputBox("Unesite datum", "Obavezan format datuma je 01_01_0001", @MDAY & "_" & @MON & "_" & @YEAR, " M10", 50, 140)
    If @error = 1 Then
        MsgBox(0, "Statistika ulazaka", "Prikaz statistike otkazan")
    Else
        If StringRegExp($inputdatum, "^\d{2}_\d{2}_\d{4}$") Then
            $datum = _NowCalcDate()
;~          $konvdatum = StringSplit($datum, "/")
;~          $novidatuma = Number($konvdatum[3]) & "." & Number($konvdatum[2]) & "." & StringRight($konvdatum[1], 4)
;~          $statsgotovina = _FileListToArray($folder, "*" & $inputdatum & "*GOTOVINA*", 1)
;~          $statsgratis = _FileListToArray($folder, "*" & $inputdatum & "*GRATIS*", 1)
;~          If $statsgratis = "" Then
;~              $statsgratis = "0"
;~          Else
;~              $statsgratis = $statsgratis[0]
;~          EndIf
;~          If $statsgotovina = "" Then
;~              $statsgotovina = "0"
;~          Else
;~              $statsgotovina = $statsgotovina[0]
;~          EndIf
            MsgBox(0, "Statistika ulazaka", "Statistika za dan " & $inputdatum & @CRLF & @CRLF & "Broj ulazaka placenih gotovinom: " & "" & @CRLF & "Broj ulazaka GRATIS :" & "")
        Else
            MsgBox(0, "Statistika ulazaka", "Krivi format datuma")
        EndIf
    EndIf
EndFunc   ;==>statistika1

Func razlika_u_provjeri_vremena()
    Local $sTime1 = $inputulaz, $sTime2 = _NowTime()
    Local $iTime1, $iTime2, $iTime24
    Local $aTemp, $sHour, $sMinute, $sSecond
    $aTemp = StringSplit($sTime1, ":")
    $iTime1 = _TimeToTicks($aTemp[1], $aTemp[2], $aTemp[3])
    $aTemp = StringSplit($sTime2, ":")
    $iTime2 = _TimeToTicks($aTemp[1], $aTemp[2], $aTemp[3])
    _TicksToTime($iTime2 - $iTime1, $sHour, $sMinute, $sSecond)
    If Number(StringReplace($sTime1, ":", "")) < Number(StringReplace($sTime2, ":", "")) Then
        _TicksToTime($iTime2 - $iTime1, $sHour, $sMinute, $sSecond) ; No 24 hr rollover
    Else
        $iTime24 = _TimeToTicks("24", "00", "00") ; 24 hr rollover
        _TicksToTime($iTime2 + $iTime24 - $iTime1, $sHour, $sMinute, $sSecond)
    EndIf
    Global $razlika = StringRight("0" & $sHour, 2) & ":" & StringRight("0" & $sMinute, 2) & ":" & StringRight("0" & $sSecond, 2)
EndFunc   ;==>razlika_u_provjeri_vremena

Func ulaznovrijeme1()
    GUICtrlSetData($listulaz, @HOUR & ":" & @MIN)
EndFunc   ;==>ulaznovrijeme1

Func oprogramu1()

    MsgBox(0, "Kontakt", "Vaše upite ili komentare možete slati na e-mail:" & @CRLF & @CRLF & "darkman@doctor.com")
EndFunc   ;==>oprogramu1

Func search1()
    Global $bezveze, $MenuItem10, $MenuItem11
    If $bezveze = 9999 Then
        $pitanje = MsgBox(4 + 64, "", "Rezultati vaše prethodne pretrage biti ce obrisani." & @CRLF & "Želite li nastaviti dalje?")
        If $pitanje = 6 Then
            GUICtrlDelete($MenuItem10)
            GUICtrlDelete($MenuItem11)
            $searchtext = InputBox("Tekst", "Upisati traženi tekst:" & @CRLF & "(biti ce pretražena mapa" & " " & $folder & ")", "", " M", 500, 140)
            If @error = 1 Then
                Sleep(100)
            Else
                $aArray = _RecFileListToArray($folder, "*" & $searchtext & "*.txt", 1)
                $nadenifile = _ArrayToString($aArray, "", 1)
                $beztxt = StringReplace($nadenifile, ".txt", ".")
                $found = StringSplit($beztxt, ".")
                $MenuItem10 = GUICtrlCreateMenu("<---->", -1, 3)
                $MenuItem11 = GUICtrlCreateMenu("&Pronadene datoteke", -1, 4)
                $iJ = UBound($aArray, 1)
                For $i = 1 To $iJ - 1 ;Loop
                    $nadjeno = GUICtrlCreateMenuItem($found[$i], $MenuItem11)
                    GUICtrlSetOnEvent(Default, '_Menu')
                Next
            EndIf
        Else
            Sleep(88)
        EndIf
    Else
        $searchtext = InputBox("Tekst", "Upisati traženi tekst:" & @CRLF & "(biti ce pretražena mapa" & " " & $folder & ")", "", " M", 500, 140)
        If @error = 1 Then
            Sleep(100)
        Else
            $aArray = _RecFileListToArray($folder, "*" & $searchtext & "*.txt", 1)
            $nadenifile = _ArrayToString($aArray, "", 1)
            $beztxt = StringReplace($nadenifile, ".txt", ".")
            $found = StringSplit($beztxt, ".")
            $MenuItem10 = GUICtrlCreateMenu("<---->", -1, 3)
            $MenuItem11 = GUICtrlCreateMenu("&Pronadene datoteke", -1, 4)
            $iJ = UBound($aArray, 1)
            For $i = 1 To $iJ - 1 ;Loop
                $nadjeno = GUICtrlCreateMenuItem($found[$i], $MenuItem11)
                GUICtrlSetOnEvent(Default, '_Menu')
            Next
            $bezveze = 9999
        EndIf
    EndIf

EndFunc   ;==>search1

Func _Menu()
    ; run the found entry
    $datoteka = ShellExecute($folder & GUICtrlRead(@GUI_CtrlId, 1) & ".txt", @SW_MAXIMIZE)
EndFunc   ;==>_Menu

Func _UpdateMenuClock($hWnd, $msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    GUICtrlSetData($cMenu, _StringRepeat(" ", 10) & StringFormat("%02d:%02d:%02d", @HOUR, @MIN, @SEC))
EndFunc   ;==>_UpdateMenuClock

Func izlaz1()
    Exit
EndFunc   ;==>izlaz1

Func _Edit_Changed()
    _GUICtrlComboBox_AutoComplete($listime)
EndFunc   ;==>_Edit_Changed

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
    If Not IsHWnd($listime) Then $hWndCombo = GUICtrlGetHandle($listime)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    Switch $hWndFrom
        Case $listime, $hWndCombo
            Switch $iCode
                Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
                    _Edit_Changed()
            EndSwitch

    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND
Link to comment
Share on other sites

$something = "True" is making $something contain the string True, not the value true.

$column = "1" is making $column contain the string 1, which shouldn't make a difference unless you're using "==" later in the script when you shouldn't be.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

dickjones007,

I am not your personal code slave - I offer help as and when I can to anyone who asks, not just you. So do not push your luck - clear? ;)

If you add the correct parameter to the _GUIListViewEx_Init line then you can sort the ListView by clicking on the column header: :)

$iLV_Index = _GUIListViewEx_Init($hListView, "", 0, 0, False, 3) ; Not3 3 and not 2 as before
.

Or do you want the ListView to sort automatically each time you add another row? if so, on which column should it sort? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

calling out your name wasnt intended as such. i just thought you were slightly into my problems so you could solve it faster than others.

i realize the vastness of this forum and i see how many questions/problems per hour there is here.

sorry and no disrespect to you or anyone else. wont happen again.

also i really appreciate the hard work you and other coders do here.

Link to comment
Share on other sites

  • Moderators

dickjones007,

Fine - now answer the questions I asked about the sorting. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...