Moderators Melba23 Posted December 22, 2013 Moderators Share Posted December 22, 2013 dickjones007,Post an example of an ini file and a link to (or copy of) the IniToArray.au3 UDF and I will see what I can do to help - anyone else interested will probably need them as well. But it will probably be tomorrow before you get a response from me as I am cooking dinner this evening and it is getting close to the crucial time-critical bits just before serving! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dickjones007 Posted December 22, 2013 Author Share Posted December 22, 2013 attached files example ini and Initoarray au3.rar Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 23, 2013 Moderators Share Posted December 23, 2013 dickjones007,I cannot make head nor tail of that UDF so I have written a couple of new functions tailored to your particular ini file. They are at the bottom of this script, which works fine when I test it with a simple "test.ini" file in the same folder:expandcollapse popup#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)) _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, 3) 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 Local $aIniArray = _IniToArray("test.ini", "backup tablica") For $i = 0 To UBound($aIniArray) - 1 _GUIListViewEx_Insert($aIniArray[$i]) Next While 1 Local $msg = TrayGetMsg() If $msg = $exititem Then ExitLoop ; Wait for DblClk on ListView to edit _GUIListViewEx_EditOnClick() WEnd #cs If FileExists($inifolder) Then Sleep(100) Else DirCreate($inifolder) EndIf $IniNameFile = $inifolder & @MDAY & "_" & @MON & "_" & @YEAR & " backup dnevna tablica.ini" #ce Func dodajlist1() 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("test.ini", "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) 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 ; ############################################################################ Func _IniToArray($sFile, $sSection) $aIni = IniReadSection($sFile, $sSection) Local $aArray[$aIni[0][0]] For $i = 1 To $aIni[0][0] $aArray[$i - 1] = $aIni[$i][1] Next Return $aArray EndFunc ;==>_IniToArray Func _ArrayToIni($sFile, $sSection, $aArray) IniDelete($sFile, $sSection) For $i = 0 To UBound($aArray) - 1 IniWrite($sFile, $sSection, $i, $aArray[$i]) Next EndFunc ;==>_ArrayToIniYou will, of course, need to add code to set the required path and name for your actual ini file. M23 robertocm 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dickjones007 Posted December 27, 2013 Author Share Posted December 27, 2013 (edited) just got around to testing this after holiday stuff and on that note merry xmas everyone and a happy new year melba thank you so much for that solution works perfectly and is much simpler Edited December 27, 2013 by dickjones007 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now