Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/23/2016 in all areas

  1. Gianni

    ascii art clock

    Hi UEZ, nice version !. you used a matrix of labels as chars container to build and position clock hands in fixed position... interesting solution. (as you can see is harder using simple ascii chars than GDI+... ) Nice analog Clock BTW I approched the problem in a different way, I used just one big label as a blackboard where i can write at any location using the PrePrint() / Print() functions that allows me to specifing the wanted horizontal and vertical locations where to print chars or strings as well. Down here there is my experimental version: ... here we go... #include <GUIConstants.au3> HotKeySet("{ESC}", "EndOfTime") Global $sBuffer = _StringReplicate(" ", 80) & @CRLF ; a string of 80 blank spaces + @crlf $sBuffer = _StringReplicate($sBuffer, 24) ; 25 of above lines Global $MyGui = GUICreate("", 400, 300, -1, -1, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_COMPOSITED, $WS_EX_LAYERED)) Global $hClock = GUICtrlCreateLabel("", 0, 0, 400, 400, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 7, 0, 0, "Courier new") GUICtrlSetData($hClock, $sBuffer) GUISetState() ; X, Y, Ray, Char, Step TextCircle(40, 13, 12, "", 12) ; draw Hours on clock TextCircle(40, 13, 11, ".", 60) ; draw Mins on clock PrePrint("O", 40, 13) ; center of the clock While 1 $iHour = @HOUR $iMin = @MIN $iSec = @SEC For $ii = 1 To 7 ; draw clock hands TextPosOnCircle(40, 13, 8 - $ii, 'H', 12, $iHour) ; 1 houur TextPosOnCircle(40, 13, 9 - $ii, 'm', 60, $iMin) ; 1 min TextPosOnCircle(40, 13, 10 - $ii, '.', 60, $iSec) ; 1 min Next PrePrint($iHour & ":" & $iMin & ":" & $iSec, 36, 19) Print(); show whole buffer on the label Sleep(1000) For $ii = 1 To 7 ; erase clock hands TextPosOnCircle(40, 13, 8 - $ii, ' ', 12, $iHour) ; 1 houur TextPosOnCircle(40, 13, 9 - $ii, ' ', 60, $iMin) ; 1 min TextPosOnCircle(40, 13, 10 - $ii, ' ', 60, $iSec) ; 1 min Next WEnd ; From HtabVtab (1 based) to Absolute ; ----------------------------------- Func GetAbsPos($iHtab = 1, $iVtab = 1, $iScreenWidth = 80) Return ($iVtab - 1) * ($iScreenWidth + 2) + $iHtab ; position within the String buffer EndFunc ;==>GetAbsPos Func PrePrint($sString = "", $iHtab = 1, $iVtab = 1) ; Print to String Buffer only $sBuffer = StringReplace($sBuffer, GetAbsPos($iHtab, $iVtab), $sString) EndFunc ;==>PrePrint Func Print() ; Copy String Buffer to Label GUICtrlSetData($hClock, $sBuffer) EndFunc ;==>Print ; returns one or more chars replicated n times ; Example: ConsoleWrite(_StringReplicate('*', 5) & @CRLF) Func _StringReplicate($sChars = "", $iRepeats = 0) $sChars = String($sChars) $iRepeats = Int(Abs(Number($iRepeats))) Return StringReplace(StringFormat('%' & $iRepeats & 's', ""), " ", $sChars) EndFunc ;==>_StringReplicate ; Drawing a circle using SIN and COS Func TextCircle($cx = 40, $cy = 12, $r = 12, $sChar = "", $iStep = 12) Local $pi = 3.14159, $nr = 0 For $i = 1.56 To (2 * $pi) + 1.56 Step ($pi * 2) / $iStep $x = Cos($i) * $r * 3 ; compensate horizontally $y = Sin($i) * $r PrePrint(($sChar = "" ? $nr : $sChar), Int($cx - $x), Int($cy - $y)) $nr += 1 Next Print() EndFunc ;==>TextCircle ; position a char along a circle to a wanted point Func TextPosOnCircle($cx, $cy, $r, $sChar, $iStep, $iValue) Local $pi = 3.14159 Local $iStepper = (($pi * 2) / $iStep) $i = 1.56 + ((($iValue + 1) * $iStepper) - $iStepper) $x = Cos($i) * $r * 3 ; compensate harizontal $y = Sin($i) * $r PrePrint($sChar, Int($cx - $x), Int($cy - $y)) ; Print() EndFunc ;==>TextPosOnCircle Func EndOfTime() If WinActive("[ACTIVE]") = $MyGui Then Exit EndFunc ;==>EndOfTime
    2 points
  2. UEZ

    ascii art clock

    Here a version for a ASCII Analogue Clock - (GDI+ free version ): ;coded by UEZ build 2016-02-23 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $iWm = 29, $iHm = 19, $imX = Ceiling($iWm / 2), $imY = Ceiling($iHm / 2), $fRad = ACos(-1) / 180 Global $aArrayMatrix[$iHm + 1][$iWm + 1], $aPic[$iHm], $i, $f = $iHm Global Const $iW = Ceiling($iWm * $f * 2 / 3) - $iWm / 2, $iH = $iHm * $f, $iW2 = $iW / 2 Global Const $hGUI = GUICreate("ASCII Analogue Clock by UEZ v1.1", $iW, $iH, -1, -1, -1, $WS_EX_COMPOSITED) For $i = 0 To $iHm - 1 $aPic[$i] = GUICtrlCreateLabel("", 0, $i * $f, $iW, $f) GUICtrlSetFont(-1, $f * 0.825, 800, 0, "Courier new", 5) GUICtrlSetBkColor(-1, Sin($i * $iHm / 0x150) * 0x100 + 0xFF00) GUICtrlSetColor(-1, 0x0) Next GUISetState() AnimClock() GUIRegisterMsg($WM_TIMER, "AnimClock") DllCall("user32.dll", "int", "SetTimer", "hwnd", $hGUI, "int", 0, "int", 1000, "int", 0) Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_TIMER, "") GUIDelete() Exit EndSwitch Until False Func AnimClock() Local $i, $iX, $iY, $sx, $imm = $iWm, $sBg = " " Local $aSlope_Hr = CalcSlope( $imY, $imX, $imY + Cos((-90 + 30 * (Mod(@HOUR, 12) + @MIN / 60)) * $fRad) * $imX * 0.45, $imX + Sin((-90 + 30 * (Mod(@HOUR, 12) + @MIN / 60)) * $fRad) * $imY * 0.45) Local $aSlope_Min = CalcSlope( $imY, $imX, $imY + Cos((-90 + 6 * @MIN) * $fRad) * $imX * 0.65, $imX + Sin((-90 + 6 * @MIN) * $fRad) * $imY * 0.65) Local $aSlope_Sec = CalcSlope( $imY, $imX, $imY + Cos((-90 + 6 * @SEC) * $fRad) * $imX * 0.85, $imX + Sin((-90 + 6 * @SEC) * $fRad) * $imY * 0.85) Local $aSlope_Sec2 = CalcSlope( $imY, $imX, $imY + Cos((-270 + 6 * @SEC) * $fRad) * $imX * 0.35, $imX + Sin((-270 + 6 * @SEC) * $fRad) * $imY * 0.35) Local Const $fSy_hr = $aSlope_Hr[0] / $imm Local Const $fSx_hr = $aSlope_Hr[1] / $imm Local Const $fSy_min = $aSlope_Min[0] / $imm Local Const $fSx_min = $aSlope_Min[1] / $imm Local Const $fSy_sec = $aSlope_Sec[0] / $imm Local Const $fSx_sec = $aSlope_Sec[1] / $imm Local Const $fSy_sec2 = $aSlope_Sec2[0] / $imm Local Const $fSx_sec2 = $aSlope_Sec2[1] / $imm For $i = $imm To 0 Step - 1 $aArrayMatrix[$imY - 1 + Round($i * $fSy_min)][$imX - 1 + Round($i * $fSx_min)] = ChrW(9618) $aArrayMatrix[$imY - 1 + Round($i * $fSy_hr) ][$imX - 1 + Round($i * $fSx_hr)] = ChrW(9617) Next For $i = $imm To 0 Step - 1 ;write seconds to the top $aArrayMatrix[$imY - 1 + Round($i * $fSy_sec)][$imX - 1 + Round($i * $fSx_sec)] = ChrW(9619) $aArrayMatrix[$imY - 1 + Round($i * $fSy_sec2)][$imX - 1 + Round($i * $fSx_sec2)] = ChrW(9619) Next $aArrayMatrix[$iHm - 1][0] = "U" $aArrayMatrix[$iHm - 1][1] = "E" $aArrayMatrix[$iHm - 1][2] = "Z" $aArrayMatrix[$iHm - 1][3] = ChrW(9786) $aArrayMatrix[$imY + 4][$imX - 1] = @HOUR > -1 And @HOUR < 12 ? "A" : "P" $aArrayMatrix[$imY + 4][$imX] = "M" For $i = 0 To 360 Step 30 $aArrayMatrix[$imY - 1 + Round(Cos($i * $fRad) * $imY * 0.92)][$imX - 1 + Round(Sin($i * $fRad) * $imX * 0.92)] = "." Next For $iY = 0 To $iHm - 1 $sx = "" For $iX = 0 To $iWm - 1 $t = $aArrayMatrix[$iY][$iX] $t = ($t = "") ? $sBg : $t Switch $iX Case 0 Switch $iY Case $imY - 1 $t = "9" EndSwitch Case $iWm - 1 Switch $iY Case $imY - 1 $t = "3" EndSwitch Case $imX - 1 Switch $iY Case 0 $t = "12" Case $iHm - 1 $t = "6" Case $iMy - 1 $t = ChrW(8986) EndSwitch EndSwitch $sx &= $t $aArrayMatrix[$iY][$iX] = $sBg Next GUICtrlSetData($aPic[$iY], $sx) Next EndFunc Func CalcSlope($iX1, $iY1, $iX2, $iY2) Local $aSlope[2] = [$iY2 - $iY1, $iX2 - $iX1] Return $aSlope EndFunc
    2 points
  3. Damein

    RSS Movie Database

    I created one of these awhile back but decided I could do a little better and wrote this up. I think it came out quite nicely myself! YouTube Demo: GitHub: https://github.com/Tf2Prophete/RSS-Movie-Database Screenshots Main GUI Movie Info Add Movie GUI Source: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Imgs\Icon.ico #AutoIt3Wrapper_Compression=0 #AutoIt3Wrapper_Res_Fileversion=2.1.0.0 #AutoIt3Wrapper_Res_LegalCopyright=R.S.S. #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <Timers.au3> #include <TrayConstants.au3> #include <ButtonConstants.au3> #include ".\Skins\Cosmo.au3" #include "_UskinLibrary.au3" _Uskin_LoadDLL() _USkin_Init(_Cosmo(True)) Opt("GUIOnEventMode", 1) Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) Global $CurrentGui, $AZTreeView, $InputMovieDescription = 0, $InputMovieGenre = 0, $InputMovieTitle = 0, $Stop = 0, $CheckMovieAddition = 0 Global $MainGui, $CurrentListSelection, $OldListSelection, $Msg, $StartTimer, $DefaultButton, $CurrentMovieDescription, $CurrentMovieGenre, $CurrentMovieWatchCount Global $CurrentMovieTitle, $MovieDataGui, $GenericPicture, $MoviePicture, $CheckPicture, $CurrentMoviePictureCheck, $DisplayMovieTitle, $CheckFavorite Global $FavoritesList, $CurrentMovieFavoriteCheck, $NumberList, $CurrentMovieGenreDisplay, $CurrentMovieTitleDisplay, $CurrentMovieDescriptionDisplay Global $CurrentMovieFavoriteDisplay, $CurrentMoviePictureDisplay, $EditButton, $SaveButton, $TrimTitleForSelection, $MovieButton Global $MoviePictureYesRadio, $MoviePictureNoRadio, $MovieFavoriteYesRadio, $MovieFavoriteNoRadio, $EditMoviePicture = "0", $EditMovieFavorite = "0" Dim $Alphabet[27] = [26, "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] Dim $AZList[27] $CheckFirstRun = IniRead(@ScriptDir & "/Data/Settings.ini", "Settings", "FirstRun", "NA") If $CheckFirstRun = 0 Then MsgBox(48, "Warning", "Please be aware, to get the images for movies to work properly you will need to save them as .jpg and will also need to name them the same as you did the movie title!") MsgBox(0, "Note", "If you wish to see this message again you may go into the Settings.ini file in the Data folder and change the 1 to a 0") IniWrite(@ScriptDir & "/Data/Settings.ini", "Settings", "FirstRun", "1") EndIf TrayCreateItem("Exit...") TrayItemSetOnEvent(-1, "_CloseProgram") TrayCreateItem("Refresh Database...") TrayItemSetOnEvent(-1, "_UpdateDatabase") _ReCreateMainGui() _UpdateDatabase() Func _ReCreateMainGui() $CurrentGui = "Main" $MainGui = GUICreate("Movie Database - RSSoftware", 800, 600) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlCreateLabel("© RS Software", 730, 575, 200) GUICtrlSetFont(-1, 8) GUICtrlCreateLabel("Version 2.1", 738, 585, 200) GUICtrlSetFont(-1, 8) $AZTreeView = GUICtrlCreateTreeView(5, 80, 200, 515, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $FavoritesList = GUICtrlCreateTreeViewItem("Favorites", $AZTreeView) $NumberList = GUICtrlCreateTreeViewItem("#", $AZTreeView) For $i = 1 To $Alphabet[0] $AZList[$i] = GUICtrlCreateTreeViewItem($Alphabet[$i], $AZTreeView) Next $AddMovieButton = GUICtrlCreateButton("Add Movie", 20, 10, 200, 50) GUICtrlSetOnEvent(-1, "_AddMovie") GUICtrlSetFont(-1, 16) $OptionsButton = GUICtrlCreateButton("Refresh Database", 580, 10, 200, 50) GUICtrlSetOnEvent(-1, "_UpdateDatabase") GUICtrlSetFont(-1, 16) $RemoveMovieButton = GUICtrlCreateButton("Remove Movie", 300, 10, 200, 50) GUICtrlSetOnEvent(-1, "_RemoveMovie") GUICtrlSetFont(-1, 16) $GenericPicture = GUICtrlCreatePic(@ScriptDir & "/Imgs/DefaultImg.jpg", 385, 160, 250, 300) $MoviePicture = GUICtrlCreatePic(@ScriptDir & "/Imgs/DefaultImg.jpg", 385, 160, 250, 300) $DefaultButton = GUICtrlCreateButton("Movie Information", 360, 500, 300, 80) GUICtrlSetOnEvent(-1, "_DefaultButton") GUICtrlSetFont(-1, 22) GUICtrlSetState($AZList[1], $GUI_FOCUS) $DisplayMovieTitle = GUICtrlCreateInput("", 220, 95, 570, 40, BitOR($ES_ReadOnly, $ES_Center)) GUICtrlSetFont(-1, 22) GUICtrlSetColor(-1, 0x00CCFF) GUISetState(@SW_SHOW) EndFunc ;==>_ReCreateMainGui Func _DefaultButton() MsgBox(0, "Hello!", "Please select a movie to see the movie information! Or add a movie if you haven't yet!") EndFunc ;==>_DefaultButton Func _GetMovieData() $GetTitleLength = StringLen($CurrentListSelection) $TrimTitleForSelection = StringTrimRight($CurrentListSelection, $GetTitleLength - 1) If StringIsDigit($TrimTitleForSelection) Then $MovieData = IniReadSection(@ScriptDir & "/Data/# List/" & $CurrentListSelection & ".ini", $CurrentListSelection) EndIf If StringIsAlpha($TrimTitleForSelection) Then $MovieData = IniReadSection(@ScriptDir & "/Data/AZList/" & $TrimTitleForSelection & "/" & $CurrentListSelection & ".ini", $CurrentListSelection) EndIf $CurrentMovieTitle = $CurrentListSelection $CurrentMovieGenre = $MovieData[1][1] $CurrentMovieDescription = $MovieData[2][1] $CurrentMoviePictureCheck = $MovieData[3][1] $CurrentMovieFavoriteCheck = $MovieData[4][1] If $MovieData[3][1] = 1 Then If FileExists(@ScriptDir & "/Imgs/" & $CurrentListSelection & ".jpg") Then GUICtrlDelete($MoviePicture) GUICtrlSetState($GenericPicture, $GUI_HIDE) $MoviePicture = GUICtrlCreatePic(@ScriptDir & "/Imgs/" & $CurrentListSelection & ".jpg", 385, 160, 250, 300) GUICtrlSetState($MoviePicture, $GUI_SHOW) Else GUICtrlSetState($MoviePicture, $GUI_HIDE) GUICtrlSetState($GenericPicture, $GUI_SHOW) EndIf Else GUICtrlSetState($MoviePicture, $GUI_HIDE) GUICtrlSetState($GenericPicture, $GUI_SHOW) EndIf GUICtrlDelete($DefaultButton) GUICtrlDelete($MovieButton) $MovieButton = GUICtrlCreateButton("Movie Information", 360, 500, 300, 80) GUICtrlSetOnEvent(-1, "_ReadMovieData") GUICtrlSetFont(-1, 22) GUICtrlSetData($DisplayMovieTitle, $CurrentMovieTitle) EndFunc ;==>_GetMovieData Func _ReadMovieData() GUISetState(@SW_DISABLE, $MainGui) $CurrentGui = "MovieDataGui" $MovieDataGui = GUICreate($CurrentMovieTitle, 400, 520) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlCreateLabel("Movie Title", 150, 10, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) $CurrentMovieTitleDisplay = GUICtrlCreateInput($CurrentMovieTitle, 10, 40, 380, 30, BitOR($ES_Center, $ES_ReadOnly)) GUICtrlSetFont(-1, 12) GUICtrlSetColor(-1, 0x00CCFF) GUICtrlCreateLabel("Movie Genre", 140, 90, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) $CurrentMovieGenreDisplay = GUICtrlCreateInput($CurrentMovieGenre, 10, 120, 380, 30, BitOR($ES_Center, $ES_ReadOnly)) GUICtrlSetFont(-1, 12) GUICtrlSetColor(-1, 0x00CCFF) GUICtrlCreateLabel("Movie Picture", 140, 170, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) GUIStartGroup() $MoviePictureYesRadio = GUICtrlCreateRadio("Yes", 145, 210, 60, 20, $BS_Center) GUICtrlSetFont(-1, 14) GUICtrlSetState($MoviePictureYesRadio, $GUI_HIDE) GUICtrlSetOnEvent(-1, "_YesPicture") $MoviePictureNoRadio = GUICtrlCreateRadio("No", 215, 210, 60, 20, $BS_Center) GUICtrlSetFont(-1, 14) GUICtrlSetState($MoviePictureNoRadio, $GUI_HIDE) GUICtrlSetOnEvent(-1, "_NoPicture") If $CurrentMoviePictureCheck = 1 Then $DisplayPicture = "Yes" $EditMoviePicture = "1" GUICtrlSetState($MoviePictureYesRadio, $GUI_CHECKED) Else $DisplayPicture = "No" $EditMoviePicture = "0" GUICtrlSetState($MoviePictureNoRadio, $GUI_CHECKED) EndIf $CurrentMoviePictureDisplay = GUICtrlCreateInput($DisplayPicture, 10, 200, 380, 30, BitOR($ES_Center, $ES_ReadOnly)) GUICtrlSetFont(-1, 12) GUICtrlSetColor(-1, 0x00CCFF) GUICtrlCreateLabel("Movie Favorited", 125, 250, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) GUIStartGroup() $MovieFavoriteYesRadio = GUICtrlCreateRadio("Yes", 145, 290, 60, 20, $BS_Center) GUICtrlSetFont(-1, 14) GUICtrlSetState($MovieFavoriteYesRadio, $GUI_HIDE) GUICtrlSetOnEvent(-1, "_YesFavorite") $MovieFavoriteNoRadio = GUICtrlCreateRadio("No", 215, 290, 60, 20, $BS_Center) GUICtrlSetFont(-1, 14) GUICtrlSetState($MovieFavoriteNoRadio, $GUI_HIDE) GUICtrlSetOnEvent(-1, "_NoFavorite") If $CurrentMovieFavoriteCheck = 1 Then $EditMovieFavorite = "1" $DisplayFavorite = "Yes" GUICtrlSetState($MovieFavoriteYesRadio, $GUI_CHECKED) Else $DisplayFavorite = "No" $EditMovieFavorite = "0" GUICtrlSetState($MovieFavoriteNoRadio, $GUI_CHECKED) EndIf $CurrentMovieFavoriteDisplay = GUICtrlCreateInput($DisplayFavorite, 10, 280, 380, 30, BitOR($ES_Center, $ES_ReadOnly)) GUICtrlSetFont(-1, 12) GUICtrlSetColor(-1, 0x00CCFF) GUICtrlCreateLabel("Movie Description", 120, 330, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) $CurrentMovieDescriptionDisplay = GUICtrlCreateEdit($CurrentMovieDescription, 10, 360, 380, 100, BitOR($ES_Center, $ES_ReadOnly)) GUICtrlSetFont(-1, 12) GUICtrlSetColor(-1, 0x00CCFF) $EditButton = GUICtrlCreateButton("Edit Movie", 10, 470, 180, 50) GUICtrlSetOnEvent(-1, "_EditMovie") GUICtrlSetFont(-1, 16) $SaveButton = GUICtrlCreateButton("Save Movie", 10, 470, 180, 50) GUICtrlSetOnEvent(-1, "_SaveMovie") GUICtrlSetFont(-1, 16) GUICtrlSetState(-1, $GUI_HIDE) $CloseButton = GUICtrlCreateButton("Close", 210, 470, 180, 50) GUICtrlSetOnEvent(-1, "_Exit") GUICtrlSetFont(-1, 16) GUISetState() EndFunc ;==>_ReadMovieData Func _YesPicture() $EditMoviePicture = "1" EndFunc ;==>_YesPicture Func _NoPicture() $EditMoviePicture = "0" EndFunc ;==>_NoPicture Func _YesFavorite() $EditMovieFavorite = "1" EndFunc ;==>_YesFavorite Func _NoFavorite() $EditMovieFavorite = "0" EndFunc ;==>_NoFavorite Func _EditMovie() GUICtrlSetState($EditButton, $GUI_HIDE) GUICtrlSetState($SaveButton, $GUI_SHOW) GUICtrlSetStyle($CurrentMovieGenreDisplay, $GUI_SS_DEFAULT_INPUT) GUICtrlSetStyle($CurrentMovieGenreDisplay, $ES_CENTER) GUICtrlSetColor($CurrentMovieGenreDisplay, 0xfb0000) GUICtrlSetStyle($CurrentMovieDescriptionDisplay, $GUI_SS_DEFAULT_INPUT) GUICtrlSetStyle($CurrentMovieDescriptionDisplay, $ES_CENTER) GUICtrlSetColor($CurrentMovieDescriptionDisplay, 0xfb0000) GUICtrlSetState($CurrentMoviePictureDisplay, $GUI_HIDE) GUICtrlSetState($CurrentMovieFavoriteDisplay, $GUI_HIDE) GUICtrlSetState($MoviePictureYesRadio, $GUI_SHOW) GUICtrlSetState($MoviePictureNoRadio, $GUI_SHOW) GUICtrlSetState($MovieFavoriteYesRadio, $GUI_SHOW) GUICtrlSetState($MovieFavoriteNoRadio, $GUI_SHOW) EndFunc ;==>_EditMovie Func _SaveMovie() $EditMovieGenre = GUICtrlRead($CurrentMovieGenreDisplay) $EditMovieDescription = GUICtrlRead($CurrentMovieDescriptionDisplay) If StringIsDigit($TrimTitleForSelection) Then IniWrite(@ScriptDir & "/Data/# List/" & $CurrentMovieTitle & ".ini", $CurrentMovieTitle, "Genre", $EditMovieGenre) IniWrite(@ScriptDir & "/Data/# List/" & $CurrentMovieTitle & ".ini", $CurrentMovieTitle, "Description", $EditMovieDescription) IniWrite(@ScriptDir & "/Data/# List/" & $CurrentMovieTitle & ".ini", $CurrentMovieTitle, "Picture", $EditMoviePicture) IniWrite(@ScriptDir & "/Data/# List/" & $CurrentMovieTitle & ".ini", $CurrentMovieTitle, "Favorite", $EditMovieFavorite) EndIf If StringIsAlpha($TrimTitleForSelection) Then IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForSelection & "/" & $CurrentMovieTitle & ".ini", $CurrentMovieTitle, "Genre", $EditMovieGenre) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForSelection & "/" & $CurrentMovieTitle & ".ini", $CurrentMovieTitle, "Description", $EditMovieDescription) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForSelection & "/" & $CurrentMovieTitle & ".ini", $CurrentMovieTitle, "Picture", $EditMoviePicture) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForSelection & "/" & $CurrentMovieTitle & ".ini", $CurrentMovieTitle, "Favorite", $EditMovieFavorite) EndIf If $EditMovieFavorite = 1 Then If StringIsDigit($TrimTitleForSelection) Then FileCopy(@ScriptDir & "/Data/# List/" & $CurrentMovieTitle & ".ini", @ScriptDir & "/Data/Favorites/" & $CurrentMovieTitle & ".ini", 1) Else FileCopy(@ScriptDir & "/Data/AZList/" & $TrimTitleForSelection & "/" & $CurrentMovieTitle & ".ini", @ScriptDir & "/Data/Favorites/" & $CurrentMovieTitle & ".ini", 1) EndIf Else FileDelete(@ScriptDir & "/Data/Favorites/" & $CurrentMovieTitle & ".ini") EndIf GUIDelete($MovieDataGui) GUISetState(@SW_ENABLE, $MainGui) _UpdateDatabase() EndFunc ;==>_SaveMovie Func _AddMovie() GUISetState(@SW_DISABLE, $MainGui) $CurrentGui = "MovieDataGui" $MovieDataGui = GUICreate("Add NewMovie", 400, 520) GUICtrlCreateLabel("Movie Title", 150, 10, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) $CurrentMovieTitleDisplay = GUICtrlCreateInput("", 10, 40, 380, 30, $ES_CENTER) GUICtrlSetFont(-1, 12) GUICtrlSetColor(-1, 0x00CCFF) GUICtrlSetColor($CurrentMovieTitleDisplay, 0xfb0000) GUICtrlCreateLabel("Movie Genre", 140, 90, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) $CurrentMovieGenreDisplay = GUICtrlCreateInput("", 10, 120, 380, 30, $ES_Center) GUICtrlSetFont(-1, 12) GUICtrlSetColor(-1, 0x00CCFF) GUICtrlSetColor($CurrentMovieGenreDisplay, 0xfb0000) GUICtrlCreateLabel("Movie Picture", 140, 170, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) GUIStartGroup() $MoviePictureYesRadio = GUICtrlCreateRadio("Yes", 145, 210, 60, 20, $BS_Center) GUICtrlSetFont(-1, 14) GUICtrlSetOnEvent(-1, "_YesPicture") $MoviePictureNoRadio = GUICtrlCreateRadio("No", 215, 210, 60, 20, $BS_Center) GUICtrlSetFont(-1, 14) GUICtrlSetOnEvent(-1, "_NoPicture") If $CurrentMoviePictureCheck = 1 Then $DisplayPicture = "Yes" $EditMoviePicture = "1" GUICtrlSetState($MoviePictureYesRadio, $GUI_CHECKED) Else $DisplayPicture = "No" $EditMoviePicture = "0" GUICtrlSetState($MoviePictureNoRadio, $GUI_CHECKED) EndIf GUICtrlCreateLabel("Movie Favorited", 125, 250, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) GUIStartGroup() $MovieFavoriteYesRadio = GUICtrlCreateRadio("Yes", 145, 290, 60, 20, $BS_Center) GUICtrlSetFont(-1, 14) GUICtrlSetOnEvent(-1, "_YesFavorite") $MovieFavoriteNoRadio = GUICtrlCreateRadio("No", 215, 290, 60, 20, $BS_Center) GUICtrlSetFont(-1, 14) GUICtrlSetOnEvent(-1, "_NoFavorite") If $CurrentMovieFavoriteCheck = 1 Then $EditMovieFavorite = "1" $DisplayFavorite = "Yes" GUICtrlSetState($MovieFavoriteYesRadio, $GUI_CHECKED) Else $DisplayFavorite = "No" $EditMovieFavorite = "0" GUICtrlSetState($MovieFavoriteNoRadio, $GUI_CHECKED) EndIf GUICtrlCreateLabel("Movie Description", 120, 330, 200) GUICtrlSetFont(-1, 16) GUICtrlSetColor(-1, 0xFFFFFF) $CurrentMovieDescriptionDisplay = GUICtrlCreateEdit("", 10, 360, 380, 100, $ES_Center) GUICtrlSetFont(-1, 12) GUICtrlSetColor(-1, 0x00CCFF) GUICtrlSetColor($CurrentMovieDescriptionDisplay, 0xfb0000) $AddMovieFinishedButton = GUICtrlCreateButton("Add Movie", 10, 470, 180, 50) GUICtrlSetOnEvent(-1, "_AddMovieFinished") GUICtrlSetFont(-1, 16) $CloseButton = GUICtrlCreateButton("Cancel", 210, 470, 180, 50) GUICtrlSetOnEvent(-1, "_CancelAddMovie") GUICtrlSetFont(-1, 16) GUISetState() EndFunc ;==>_AddMovie Func _CancelAddMovie() MsgBox(48, "Cancel", "Addition of movie has been cancelled!") $Stop = 0 $InputMovieDescription = 0 $InputMovieGenre = 0 $InputMovieTitle = 0 $CheckMovieAddition = 0 $CheckPicture = 0 $CheckFavorite = 0 GUISetState(@SW_ENABLE, $MainGui) $CurrentGui = "Main" GUIDelete($MovieDataGui) EndFunc ;==>_CancelAddMovie Func _AddMovieFinished() $InputMovieGenre = GUICtrlRead($CurrentMovieGenreDisplay) $InputMovieDescription = GUICtrlRead($CurrentMovieDescriptionDisplay) $InputMovieTitle = GUICtrlRead($CurrentMovieTitleDisplay) If $InputMovieGenre = "" Then $Stop = 1 MsgBox(48, "Error", "You must input a genre to continue!") EndIf If $InputMovieDescription = "" Then $Stop = 1 MsgBox(48, "Error", "You must input a movie description to continue!") EndIf If $InputMovieTitle = "" Then $Stop = 1 MsgBox(48, "Error", "You must input a movie title to continue!") EndIf If $Stop = 0 Then $GetTitleLength = StringLen($InputMovieTitle) $TrimTitleForAZList = StringTrimRight($InputMovieTitle, $GetTitleLength - 1) If StringIsDigit($TrimTitleForAZList) Then IniWrite(@ScriptDir & "/Data/# List/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Genre", $InputMovieGenre) IniWrite(@ScriptDir & "/Data/# List/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Description", $InputMovieDescription) IniWrite(@ScriptDir & "/Data/# List/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Picture", $EditMoviePicture) IniWrite(@ScriptDir & "/Data/# List/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Favorite", $EditMovieFavorite) Else $CheckIfDirExists = DirGetSize(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList) If @error Then DirCreate(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Genre", $InputMovieGenre) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Description", $InputMovieDescription) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Picture", $EditMoviePicture) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Favorite", $EditMovieFavorite) Else IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Genre", $InputMovieGenre) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Description", $InputMovieDescription) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Picture", $EditMoviePicture) IniWrite(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieTitle & ".ini", $InputMovieTitle, "Favorite", $EditMovieFavorite) EndIf EndIf If $EditMovieFavorite = 1 Then If StringIsDigit($TrimTitleForAZList) Then FileCopy(@ScriptDir & "/Data/# List/" & $InputMovieTitle & ".ini", @ScriptDir & "/Data/Favorites/" & $InputMovieTitle & ".ini", 1) Else FileCopy(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieTitle & ".ini", @ScriptDir & "/Data/Favorites/" & $InputMovieTitle & ".ini", 1) EndIf EndIf MsgBox(0, "Movie Added", "Movie " & $InputMovieTitle & " has been added!") $Stop = 0 $InputMovieDescription = 0 $InputMovieGenre = 0 $InputMovieTitle = 0 $CheckMovieAddition = 0 $CheckPicture = 0 $EditMovieFavorite = 0 GUISetState(@SW_ENABLE, $MainGui) GUIDelete($MovieDataGui) EndIf EndFunc ;==>_AddMovieFinished Func _RemoveMovie() $InputMovieToRemove = InputBox("Remove Movie", "Please input the name of the movie you wish to remove.") If @error = 1 Then MsgBox(48, "Cancelled", "Cancel was pushed, cancelling removal of movie!") EndIf If $InputMovieToRemove = "" Then MsgBox(48, "Cancelled", "No movie name input, cancelling removal of movie!") Else $GetTitleLength = StringLen($InputMovieToRemove) $TrimTitleForAZList = StringTrimRight($InputMovieToRemove, $GetTitleLength - 1) If StringIsDigit($TrimTitleForAZList) Then $CheckForIni = IniRead(@ScriptDir & "/Data/# List/" & $InputMovieToRemove & ".ini", $InputMovieToRemove, "Genre", "NA") If $CheckForIni = "NA" Then MsgBox(48, "Error", "Movie name not found, please try again!") Else $CheckDeletion = MsgBox(4, "Delete Movie", "Are you sure you wish to remove this movie?" & @CRLF & @CRLF & $InputMovieToRemove) If $CheckDeletion = 6 Then FileDelete(@ScriptDir & "/Data/# List/" & $InputMovieToRemove & ".ini") FileDelete(@ScriptDir & "/Data/Favorites/" & $InputMovieToRemove & ".ini") Else MsgBox(48, "Cancelled", "Cancelling removal of the movie!") EndIf EndIf Else $CheckIfDirExists = DirGetSize(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList) If @error Then MsgBox(48, "Error", "AZ Listing not found, please double check your input!") Else $CheckForIni = IniRead(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieToRemove & ".ini", $InputMovieToRemove, "Genre", "NA") If $CheckForIni = "NA" Then MsgBox(48, "Error", "Movie name not found, please try again!") Else $CheckDeletion = MsgBox(4, "Delete Movie", "Are you sure you wish to remove this movie?" & @CRLF & @CRLF & $InputMovieToRemove) If $CheckDeletion = 6 Then FileDelete(@ScriptDir & "/Data/AZList/" & $TrimTitleForAZList & "/" & $InputMovieToRemove & ".ini") FileDelete(@ScriptDir & "/Data/Favorites/" & $InputMovieToRemove & ".ini") Else MsgBox(48, "Cancelled", "Cancelling removal of the movie!") EndIf EndIf EndIf EndIf EndIf $InputMovieToRemove = "" GUISetState(@SW_ENABLE, $MainGui) _UpdateDatabase() EndFunc ;==>_RemoveMovie Func _UpdateDatabase() GUIDelete($MainGui) _ReCreateMainGui() $ReadAZListFolders = _FileListToArray(@ScriptDir & "/Data/AZList", Default, 2) If @error Then Sleep(10) Else For $a = 1 To $ReadAZListFolders[0] $ReadAZListFiles = _FileListToArray(@ScriptDir & "/Data/AZList/" & $ReadAZListFolders[$a], Default, 1) If @error Then Sleep(10) Else For $b = 1 To $ReadAZListFiles[0] For $c = 1 To 26 If $Alphabet[$c] = $ReadAZListFolders[$a] Then $AZListLetterToAdd = $c EndIf Next $TrimMovieTitleAZList = StringTrimRight($ReadAZListFiles[$b], 4) GUICtrlCreateTreeViewItem($TrimMovieTitleAZList, $AZList[$AZListLetterToAdd]) Next EndIf Next $ReadFavoritesFiles = _FileListToArray(@ScriptDir & "/Data/Favorites", Default, 1) If @error Then Sleep(10) Else For $d = 1 To $ReadFavoritesFiles[0] $TrimMovieTitleAZList = StringTrimRight($ReadFavoritesFiles[$d], 4) GUICtrlCreateTreeViewItem($TrimMovieTitleAZList, $FavoritesList) Next EndIf $ReadNumberFiles = _FileListToArray(@ScriptDir & "/Data/# List", Default, 1) If @error Then Sleep(10) Else For $d = 1 To $ReadNumberFiles[0] $TrimMovieTitleAZList = StringTrimRight($ReadNumberFiles[$d], 4) GUICtrlCreateTreeViewItem($TrimMovieTitleAZList, $NumberList) Next EndIf EndIf _WinAPI_RedrawWindow(GUICtrlGetHandle($AZTreeView)) EndFunc ;==>_UpdateDatabase Func _CloseProgram() Exit EndFunc ;==>_CloseProgram Func _Exit() If $CurrentGui = "Main" Then Exit EndIf If $CurrentGui = "MovieDataGui" Then GUIDelete($MovieDataGui) GUISetState(@SW_ENABLE, $MainGui) Sleep(100) $CurrentGui = "Main" WinActivate($MainGui) EndIf EndFunc ;==>_Exit While 1 $Msg = GUICtrlRead($AZTreeView, 1) $OldListSelection = $CurrentListSelection $CurrentListSelection = $Msg If $OldListSelection = $CurrentListSelection Then Sleep(10) Else If $CurrentListSelection = "Favorites" Then Sleep(10) Else $CheckStringLength = StringLen($CurrentListSelection) If $CheckStringLength > 1 Then _GetMovieData() EndIf EndIf EndIf Sleep(10) WEnd
    1 point
  4. dynamitemedia, Have you actually read the script? What do you think this function does? Func _Load_Images($sListFilter) ; Remove current images, buttons and labels For $i = 0 To $iCount - 1 GUICtrlDelete($aButton[$i]) GUICtrlDelete($aLabel[$i]) Next ; Liat the images to display $aImage = _List_Images($sListFilter) $iCount = UBound($aImage) ; Create arrays to hold button and label ControlIDs Global $aButton[$iCount], $aLabel[$iCount] ; Determine rows required $iRow_Count = Ceiling($iCount / $iCol_Count) ; Redraw buttons _Draw_Images() ; Scrol to top, hide and if required reset the scrolling _GUIScrollbars_Scroll_Page($hDialog, 0, 1) _GUIScrollBars_ShowScrollBar($hDialog, $SB_BOTH, False) If $iRow_Count > $iVisRows Then _GUIScrollbars_Generate($hDialog, 0, $iButton_Dim * $iRow_Count) EndIf EndFunc ;==>_Load_Images When I said it was a working script I was quite serious. I suggest you take some time to read and understand it before you ask any more questions. As the script uses the AutoIt include folder to list the files, you should be able to run it without problem on your machine. M23
    1 point
  5. water

    How make one Log

    Dog ate your help file? Date/time related functions/macros are easy to find.
    1 point
  6. InunoTaishou

    How make one Log

    _GUICtrlRichEdit_Create _GUICtrlRichEdit_SetCharColor _GUICtrlRichEdit_SetFont _NowTime()
    1 point
  7. I think you need to add quotes (didn't test it): $RUN=Run("Force4 C.exe " & "/AutoIt3ExecuteScript '" & $FULL & "'")
    1 point
  8. Because you should at least add a space: Run("Force4 C.exe " & "/AutoIt3ExecuteScript " & $FULL)
    1 point
  9. water

    OutlookEX UDF

    Glad you like the UDF
    1 point
  10. As always, better safe than sorry. Please note that this is completely distinct from any index you can have. Creating an index only serves to speedup searches in a specific order but doesn't imply a similar order (nor any particular order) in the output resultset. So it's safe to assume a random order in the absence of an order by clause. Operations are in this sequence (in the simplest case): 1/ the SQL is parsed and optimized for using the most useful index, if any 2/ the resultset is formed, filtered by the WHERE clause 3/ the resultset from 2/ is sorted according to the ORDER BY clause, if present 4/ the first X rows are skipped according to the OFFSET X clause, or 0 by default 5/ Y rows are output according to LIMIT Y clause, or ALL remaining rows if clause not present
    1 point
  11. when deletin in array looping from end to beginning is a good idea, because deleted indices have no affect to elements they have be to checked. Also the Blacklist can have more then 1 Element, so you need a second loop: #include <array.au3> Global $Username = "idkwhatimdoingm" Global $BlackList[3] = [2, $Username," nirs"] Local $arr = StringSplit("dgameman1.idkwhatimdoingm.ilikk.bls are my favorite. nirs", '.') _ArrayDisplay($BlackList) _ArrayDisplay($arr) For $j = 1 To UBound($BlackList) - 1 For $i= UBound($arr) - 1 To 1 Step -1 ConsoleWrite($BlackList[$j]&" = "&$arr[$i]&"?" &@TAB) If String($BlackList[$j]) = String($arr[$i]) Then ConsoleWrite("True"&@CRLF) _ArrayDelete($arr, $i) ExitLoop ;only when sure each Element in $arr is unique Else ConsoleWrite("False"&@CRLF) EndIf Next Next $arr[0]=UBound($arr)-1 _ArrayDisplay($arr) read my comment in script and console output.
    1 point
×
×
  • Create New...