Jump to content

table with values for editing


Go to solution Solved by Melba23,

Recommended Posts

whats the easiest way to do it?

i would need something like:

|    name    |    entry    |    exit    |  nr of locker  |    free    |    not free    |

--------------------------------------------------------------------

|    John     |    7:51     |    7:59  |          5          | chckbox |   chckbox    |

|      Jill       |    8:22     |    9:34  |          4          | chckbox |   chckbox    |

etc...

and one button to add rows to table

as mentioned data should be editable later

is it easier in multi gui or to add something like listview?

any ideas?

Edited by dickjones007
Link to comment
Share on other sites

  • Moderators

dickjones007,

Look at my GUIListViewEx UDF - it does everything you require. :)

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

im using it as i write this.

although having problem with one func

Func dodajlist1()
    _GUICtrlListView_AddItem($hListView, GUICtrlRead($listime), 0,2)
    _GUICtrlListView_AddSubItem($hListView, 0, GUICtrlRead($listulaz), 1)
    _GUICtrlListView_AddSubItem($hListView, 0, GUICtrlRead($listizlaz), 2)
    _GUICtrlListView_AddSubItem($hListView, 0, GUICtrlRead($listorm), 3)
EndFunc

im adding each line with a button

how to increase line number to which subitem is added

Link to comment
Share on other sites

  • Moderators

dickjones007,

If you are using my UDF then you need to use the UDF _GUIListViewEx_Insert function to add lines to the ListView - doing it yourself means that the shadow array is not updated and the UDF will certainly fail. :(

And using the UDF means that it deals with SubItems - all you need do is to pass the required data to the function as an array or a delimited string and let it worry about how to insert it. ;)

If you post your code I will try and integrate the UDF into it for 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

here is the code

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Ikone\glavna.ico
#AutoIt3Wrapper_Outfile=twister evidencija.exe
#AutoIt3Wrapper_Res_Fileversion=0.5.0.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#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
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, ($WS_MINIMIZEBOX + $WS_SYSMENU), $WS_EX_STATICEDGE)
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("&Autor", $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)
;~ GUICtrlCreateLabel("VRIJEME ULAZA/IZLAZA", 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("IZLAZ", 20, 179, 45, 15)
;~ GUICtrlSetBkColor(-1, 0x00ff00) ; Green
;~ $izlaz = GUICtrlCreateInput("", 70, 176, 50, 20, ($ES_READONLY + $SS_CENTER))
;~ $izlazbutton = GUICtrlCreateButton("UNESI VRIJEME", 130, 176, 90, 21)
;~ GUICtrlSetOnEvent($izlazbutton, "izlaznovrijeme1")

#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("Ob&riši kontakte", 607, 80, 80, 25)
GUICtrlSetOnEvent($obrisi, "obrisi1")
#endregion KONTAKT INFO

$radioplati = GUICtrlCreateRadio("Ulaz uz &placanje", 20, 210, 120, 20)
$radiogratis = GUICtrlCreateRadio("Ulaz &GRATIS", 20, 230, 120, 20)
GUICtrlSetState($radioplati, $GUI_CHECKED)

$spremi = GUICtrlCreateButton("&Spremi", 160, 220, 75, 40)
GUICtrlSetOnEvent($spremi, "spremi1")

$dodajlist = GUICtrlCreateButton("&Dodaj u tablicu", 20, 290, 95, 25)
GUICtrlSetOnEvent($dodajlist, "dodajlist1")
$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))
$listizlaz = 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))

$hListView = _GUICtrlListView_Create($Form1_1, "Ime i prezime|Vrijeme ulaska|Vrijeme izlaska|Broj ormarica|Placanje|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)


GUISetState()

;~ 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
    Local $msg = TrayGetMsg()
    If $msg = $exititem Then ExitLoop
;~  If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Func dodajlist1()
    _GUICtrlListView_AddItem($hListView, GUICtrlRead($listime), 0,2)
    _GUICtrlListView_AddSubItem($hListView, 0, GUICtrlRead($listulaz), 1)
    _GUICtrlListView_AddSubItem($hListView, 0, GUICtrlRead($listizlaz), 2)
    _GUICtrlListView_AddSubItem($hListView, 0, GUICtrlRead($listorm), 3)
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 dodaj1()
    If GUICtrlRead($listakontakt) = "" Then
        GUICtrlSetData($listakontakt, GUICtrlRead($kontakt) & ":" & GUICtrlRead($kontaktime) & @CRLF & "Kontakt broj:" & GUICtrlRead($kontaktel) & @CRLF & "Broj osobne iskaznice:" & GUICtrlRead($kontakosobn) & @CRLF & GUICtrlRead($kontakmail), 1)
    Else
        GUICtrlSetData($listakontakt, @CRLF & @CRLF & GUICtrlRead($kontakt) & ":" & GUICtrlRead($kontaktime) & @CRLF & "Kontakt broj:" & GUICtrlRead($kontaktel) & @CRLF & "Broj osobne iskaznice:" & GUICtrlRead($kontakosobn) & @CRLF & GUICtrlRead($kontakmail), 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)
    $datumrodtxt = GUICtrlRead($datumrod)
    $kontakteltxt = GUICtrlRead($kontaktel)
;~  $ulaztxt = GUICtrlRead($ulaz)
;~  $izlaztxt = GUICtrlRead($izlaz)
    If $radioplati And BitAND(GUICtrlRead($radioplati), $GUI_CHECKED) = $GUI_CHECKED Then
        Global $placenotxt = "GOTOVINA"
    Else
        Global $placenotxt = "GRATIS"
    EndIf
    $brojormtxt = StringFormat("%02d", GUICtrlRead($brojorm))
    $djelatnicitxt = GUICtrlRead($djelatnici)
    $vrstatxt = ControlGetText($Form1_1, "", "[CLASS:Edit; INSTANCE:10]")
    $listakontakttxt = GUICtrlRead($listakontakt)
    Global $avArray[10][3] = [["[IME I PREZIME]", $imeprezimetxt],["[DATUM ROÐENJA]", $datumrodtxt],["[BROJ ORMARICA]", $brojormtxt], _
            ["[SLOBODNO POLJE]", ""],["[SLOBODNO POLJE]", ""],["[PLACENO ILI GRATIS]", $placenotxt],["[SLOBODNO POLJE]", ""], _
            ["[SLOBODNO POLJE]", ""],["[SLOBODNO POLJE]", ""],["[KONTAKT OSOBA]", $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   ;==>spremi1

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 izlaznovrijeme1()
;~  GUICtrlSetData($izlaz, _NowTime())
;~ EndFunc   ;==>izlaznovrijeme1

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 = _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 izlaz1()
    Exit
EndFunc   ;==>izlaz1
Link to comment
Share on other sites

  • Moderators
  • Solution

dickjones007,

This works for me - look for the <<<<<<<<<<<<<<<< lines:

#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))

$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
    Local $msg = TrayGetMsg()
    If $msg = $exititem Then ExitLoop
;~  If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    ; Wait for DblClk on ListView to edit <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
     _GUIListViewEx_EditOnClick()

WEnd

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)

    ; Just for display <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Local $aLV_Array = _GUIListViewEx_ReturnArray($iLV_Index) ; Get current content
    _ArrayDisplay($aLV_Array) ; Display it

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
How about for 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,

 

works like a charm

Excellent. :)

 

could you help about regexp

I suggest you open a new thread. I am by no means a RegEx guru and that way those who are will see it too. ;)

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,

 

is there a way to delete checked item/s

The UDF does not do this as it is trivial to do it yourself. Loop through the ListView using _GUICtrlListView_GetItemChecked to find the selected items - once one is identified then use _GUICtrlListView_DeleteItem to delete it. And do remember to work from the bottom up! :)

 

i could remove checkboxes but then editing items and subitems is not working

And how am I supposed to offer any advice without some code illustrating the problem? You provide a script where the absence of checkboxes causes the UDF to fail and I will look into it - otherwise you are on your own. ;)

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 still get item editing without the $LVS_EX_CHECKBOXES extended style. Are you sure you are changing nothing else in the script? :huh:

M23

P.S. And you should use BitOr when stting multiple styles, not just plain addition - the Setting Styles tutorial in the Wiki explains why. ;)

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

That function only tells you how many rows the listview has, you'd use that information to loop through the listview and search for the text you're looking for. You can also use _GUICtrlListView_FindInText to search all items and subitems for the text, and loop that to keep looking until it finds all of the items.

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

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...