Leaderboard
Popular Content
Showing content with the highest reputation on 12/14/2013 in all areas
-
Case $hMsg1 = $hButton21 $file = GuiCtrlRead($path) If $file = "" Then Msgbox(0, "", "Cant be blank message") Else MsgBox(1,"ID File Location", $file ) EndIf1 point
-
Thats just the example i use as its the most often questioned in my head, and really the only magic numbers i use frequently. Like the first couple of Guiness' posts with $MB_SYSTEMMODAL and thought "umm thats more typing than the digit and no more useful".1 point
-
What about you take a hike and shut up? Please do not reply either to pollute this thread even further. Jos1 point
-
In Defence of Magic Numbers
czardas reacted to Richard Robertson for a topic
Entities created using #define are preprocessor variables, and are inserted as literal copies of the #define line's contents. "#define five 5" will replace every instance of the entity 'five' with the literal digit '5'. There are also constant source level variables. Variables can be declared as const, const pointer, pointer to const, and const pointer to const.1 point -
table with values for editing
dickjones007 reacted to Melba23 for a topic
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? M231 point -
for(int i = 0; i < pixels.length; i++){} Is a For Next loop. pixels.length is the same as AutoIts Ubound() function. The % operator is the same as AutoIts Mod() function. The && operator is the same as AutoIts And keyword. Distance can be found like this: Sqrt(($x - $cx) ^ 2 + ($y - $cy) ^ 2) #include <Math.au3> has definitions for _ATan2() and _Degree() Everything else is pretty much the same as if it were AutoIt. You can do this. It's the best way to learn. EDIT: Fixed the variable order in getting the distance.1 point
-
With 3 responses on how to improve your knowledge the only remark you give is about the one you didn't like only impedes your concept of learning. These 3 solutions should give you a better understanding of how to equate the output. Jos shows how to start the equation. markyrocks shows how to use variables with the equation. Last but not least is an example jdelaney that show a gui created by the dimensions that could easily be altered to meet your needs. As you are new to AutoIt and its forums, I've came to notice that people here try to educate not humiliate others. Just because you don't get the answer you are looking for doesn't mean that you haven't been given the tools needed to acquire the task you request. As the saying goes "Give a man a fish he can eat for a day, show a man to fish, he can eat for a lifetime"1 point
-
Get Checkbox Value then
iFFgen reacted to somdcomputerguy for a topic
Use If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then Run("notepad.exe") Edit: I'm a slow typer.. Another Edit: This'll work too, If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) = $GUI_CHECKED Then Run("notepad.exe")1 point