Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/03/2024 in all areas

  1. TheSaint

    Kobo Cover Fixer

    Indeed, and it might have borne some fruit, because I am liking my version of your indenting more and more as it grows on me. I do seriously wonder why it seems to have never occurred to me before. Especially as most of my coding is by hand. I generally only use GUIBuilder to get started, and everything is manual after that. Maybe you have just made a lasting impression on my coding.
    2 points
  2. TheSaint

    Kobo Cover Fixer

    I guess it wouldn't be too onerous to do it like the following ... just normal tabs. I shall ponder further. I also wonder why I have never thought to do this before ... probably. I might just adopt that, it is just extra tabs after all ... and it looks better. Maybe you can teach an old dog new tricks. @Werty Thanks for giving me something else to think about. P.S. I could even call it ... to Wertify my code ... not to be confused with Certify.
    2 points
  3. Werty

    Kobo Cover Fixer

    Holy codewall batman!!! Fixed your gui code identation... Kobo Cover Fixer (1).au3
    2 points
  4. That's how you declare a Map, update to the latest AutoIt version.
    1 point
  5. Werty

    Kobo Cover Fixer

    Well each his taste, I like mine more, it was just a suggestion. And yes, manual work was involved, and I gathered that you use a guibuilder that creates the mess, so probably too much work, but I like tidying up stuff manually.
    1 point
  6. TheSaint

    Kobo Cover Fixer

    Didn't think I needed to, couldn't see how you could have improved upon what I already do. But now I see what you mean. So my mistake maybe. Perhaps you should have indicated 'Special Indenting'. It has never occurred to me to do that (that I can recall). It isn't your usual indenting, like between an If and EndIf for example. I will ponder it more, but I'm not sure I like it ... though it kind of has some visual appeal. I do admit it looks a bit easier to read too. But I am also wondering how you got all those equals signs to line up? And the GUICtrlSetTip lines etc? It seems to me you would have to manually make all that happen, and I'm not in favor of doing more work, especially of such a fiddly nature. Unless you are running some kind of script to do that? Does Tidy do that perhaps? I just use the vanilla install of SciTE .... SciTE Lite. At the end of the day I try to keep it simple. P.S. I use to use multiple semi-colon ;;;; to keep some things related together, like inside a Group, to help differentiate inclusiveness etc.
    1 point
  7. Werty

    Kobo Cover Fixer

    It say 0 downloads at my upload, so you havent even seen it. I use 4 spaces too. What I mean with fixed your identation is this...(more in the download) ; CONTROLS $SS = $SS_CENTER + $SS_CENTERIMAGE + $SS_SUNKEN $Group_images = GuiCtrlCreateGroup("Ebook Images", 10, 10, 340, 458) $Pic_1 = GUICtrlCreatePic($pic_one, 20, 30, 100, 136, $SS_NOTIFY) GUICtrlSetTip ($Pic_1, "Click to see selected cover full size!") $Pic_2 = GUICtrlCreatePic($pic_two, 130, 30, 100, 136, $SS_NOTIFY) GUICtrlSetTip ($Pic_2, "Click to see selected cover full size!") $Pic_3 = GUICtrlCreatePic($pic_three, 240, 30, 100, 136, $SS_NOTIFY) GUICtrlSetTip ($Pic_3, "Click to see selected cover full size!") $Pic_4 = GUICtrlCreatePic($pic_four, 20, 176, 100, 136, $SS_NOTIFY) GUICtrlSetTip ($Pic_4, "Click to see selected cover full size!") $Pic_5 = GUICtrlCreatePic($pic_five, 130, 176, 100, 136, $SS_NOTIFY) GUICtrlSetTip ($Pic_5, "Click to see selected cover full size!") $Pic_6 = GUICtrlCreatePic($pic_six, 240, 176, 100, 136, $SS_NOTIFY) GUICtrlSetTip ($Pic_6, "Click to see selected cover full size!") $Pic_7 = GUICtrlCreatePic($pic_seven, 20, 322, 100, 136, $SS_NOTIFY) GUICtrlSetTip ($Pic_7, "Click to see selected cover full size!") $Pic_8 = GUICtrlCreatePic($pic_eight, 130, 322, 100, 136, $SS_NOTIFY) GUICtrlSetTip ($Pic_8, "Click to see selected cover full size!") $Pic_9 = GUICtrlCreatePic($pic_nine, 240, 322, 100, 136, $SS_NOTIFY) GUICtrlSetTip ($Pic_9, "Click to see selected cover full size!") ; $Group_detail = GuiCtrlCreateGroup("Clicked Image Detail", 10, 478, 340, 125) $Label_ID = GUICtrlCreateLabel("Image ID", 20, 498, 68, 20, $SS) GUICtrlSetFont ($Label_ID, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor ($Label_ID, $COLOR_BLACK) GUICtrlSetColor ($Label_ID, $COLOR_WHITE) $Input_ID = GUICtrlCreateInput("", 88, 498, 252, 20) GUICtrlSetTip ($Input_ID, "Selected ebook ID!") $Label_author = GUICtrlCreateLabel("AUTHOR", 20, 523, 68, 20, $SS) GUICtrlSetFont ($Label_author, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor ($Label_author, $COLOR_BLACK) GUICtrlSetColor ($Label_author, $COLOR_WHITE) $Input_author = GUICtrlCreateInput("", 88, 523, 252, 20) GUICtrlSetTip ($Input_author, "Selected ebook author!") $Label_title = GUICtrlCreateLabel("TITLE", 20, 548, 50, 20, $SS) GUICtrlSetFont ($Label_title, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor ($Label_title, $COLOR_BLACK) GUICtrlSetColor ($Label_title, $COLOR_WHITE) $Input_title = GUICtrlCreateInput("", 70, 548, 270, 20) GUICtrlSetTip ($Input_title, "Selected ebook title!") $Label_on = GUICtrlCreateLabel("DEVICE", 20, 573, 60, 20, $SS) GUICtrlSetFont ($Label_on, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor ($Label_on, $COLOR_RED) GUICtrlSetColor ($Label_on, $COLOR_WHITE) $Input_on = GUICtrlCreateInput("", 80, 573, 35, 20, $ES_CENTER) GUICtrlSetTip ($Input_on, "On the device status!") $Label_owned = GUICtrlCreateLabel("OWNED", 125, 573, 60, 20, $SS) GUICtrlSetFont ($Label_owned, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor ($Label_owned, $COLOR_GREEN) GUICtrlSetColor ($Label_owned, $COLOR_WHITE) $Input_owned = GUICtrlCreateInput("", 185, 573, 35, 20, $ES_CENTER) GUICtrlSetTip ($Input_owned, "Owned status!") $Label_subs = GUICtrlCreateLabel("SUBS", 230, 573, 50, 20, $SS) GUICtrlSetFont ($Label_subs, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor ($Label_subs, $COLOR_BLUE) GUICtrlSetColor ($Label_subs, $COLOR_WHITE) $Input_subs = GUICtrlCreateInput("", 280, 573, 60, 20, $ES_CENTER) GUICtrlSetTip ($Input_subs, "Sub-folder numbers!") ; $Button_prior = GuiCtrlCreateButton("RESTART", 10, 610, 90, 27) GUICtrlSetFont ($Button_prior, 8, 600) GUICtrlSetTip ($Button_prior, "Restart from the first lot of images!") ; $Checkbox_preview = GUICtrlCreateCheckbox("Preview Image", 12, 640, 90, 20) GUICtrlSetTip ($Checkbox_preview, "Show larger image preview!") ; $Button_next = GuiCtrlCreateButton("NEXT", 110, 610, 60, 50) GUICtrlSetFont ($Button_next, 9, 600) GUICtrlSetTip ($Button_next, "View the next lot of images!") ; $Button_fld = GuiCtrlCreateButton("D", 180, 610, 50, 50, $BS_ICON) GUICtrlSetTip ($Button_fld, "Open the images folder!") ; $Button_inf = GuiCtrlCreateButton("Info", 240, 610, 50, 50, $BS_ICON) GUICtrlSetTip ($Button_inf, "Viewer Information!") ; $Button_quit = GuiCtrlCreateButton("EXIT", 300, 610, 50, 50, $BS_ICON) GUICtrlSetTip ($Button_quit, "Exit / Close / Quit the window!") compared to yours... ; CONTROLS $Group_images = GuiCtrlCreateGroup("Ebook Images", 10, 10, 340, 458) $Pic_1 = GUICtrlCreatePic($pic_one, 20, 30, 100, 136, $SS_NOTIFY) GUICtrlSetTip($Pic_1, "Click to see selected cover full size!") $Pic_2 = GUICtrlCreatePic($pic_two, 130, 30, 100, 136, $SS_NOTIFY) GUICtrlSetTip($Pic_2, "Click to see selected cover full size!") $Pic_3 = GUICtrlCreatePic($pic_three, 240, 30, 100, 136, $SS_NOTIFY) GUICtrlSetTip($Pic_3, "Click to see selected cover full size!") $Pic_4 = GUICtrlCreatePic($pic_four, 20, 176, 100, 136, $SS_NOTIFY) GUICtrlSetTip($Pic_4, "Click to see selected cover full size!") $Pic_5 = GUICtrlCreatePic($pic_five, 130, 176, 100, 136, $SS_NOTIFY) GUICtrlSetTip($Pic_5, "Click to see selected cover full size!") $Pic_6 = GUICtrlCreatePic($pic_six, 240, 176, 100, 136, $SS_NOTIFY) GUICtrlSetTip($Pic_6, "Click to see selected cover full size!") $Pic_7 = GUICtrlCreatePic($pic_seven, 20, 322, 100, 136, $SS_NOTIFY) GUICtrlSetTip($Pic_7, "Click to see selected cover full size!") $Pic_8 = GUICtrlCreatePic($pic_eight, 130, 322, 100, 136, $SS_NOTIFY) GUICtrlSetTip($Pic_8, "Click to see selected cover full size!") $Pic_9 = GUICtrlCreatePic($pic_nine, 240, 322, 100, 136, $SS_NOTIFY) GUICtrlSetTip($Pic_9, "Click to see selected cover full size!") ; $Group_detail = GuiCtrlCreateGroup("Clicked Image Detail", 10, 478, 340, 125) $Label_ID = GUICtrlCreateLabel("Image ID", 20, 498, 68, 20, $SS_CENTER + $SS_CENTERIMAGE + $SS_SUNKEN) GUICtrlSetFont($Label_ID, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor($Label_ID, $COLOR_BLACK) GUICtrlSetColor($Label_ID, $COLOR_WHITE) $Input_ID = GUICtrlCreateInput("", 88, 498, 252, 20) GUICtrlSetTip($Input_ID, "Selected ebook ID!") $Label_author = GUICtrlCreateLabel("AUTHOR", 20, 523, 68, 20, $SS_CENTER + $SS_CENTERIMAGE + $SS_SUNKEN) GUICtrlSetFont($Label_author, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor($Label_author, $COLOR_BLACK) GUICtrlSetColor($Label_author, $COLOR_WHITE) $Input_author = GUICtrlCreateInput("", 88, 523, 252, 20) GUICtrlSetTip($Input_author, "Selected ebook author!") $Label_title = GUICtrlCreateLabel("TITLE", 20, 548, 50, 20, $SS_CENTER + $SS_CENTERIMAGE + $SS_SUNKEN) GUICtrlSetFont($Label_title, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor($Label_title, $COLOR_BLACK) GUICtrlSetColor($Label_title, $COLOR_WHITE) $Input_title = GUICtrlCreateInput("", 70, 548, 270, 20) GUICtrlSetTip($Input_title, "Selected ebook title!") $Label_on = GUICtrlCreateLabel("DEVICE", 20, 573, 60, 20, $SS_CENTER + $SS_CENTERIMAGE + $SS_SUNKEN) GUICtrlSetFont($Label_on, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor($Label_on, $COLOR_RED) GUICtrlSetColor($Label_on, $COLOR_WHITE) $Input_on = GUICtrlCreateInput("", 80, 573, 35, 20, $ES_CENTER) GUICtrlSetTip($Input_on, "On the device status!") $Label_owned = GUICtrlCreateLabel("OWNED", 125, 573, 60, 20, $SS_CENTER + $SS_CENTERIMAGE + $SS_SUNKEN) GUICtrlSetFont($Label_owned, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor($Label_owned, $COLOR_GREEN) GUICtrlSetColor($Label_owned, $COLOR_WHITE) $Input_owned = GUICtrlCreateInput("", 185, 573, 35, 20, $ES_CENTER) GUICtrlSetTip($Input_owned, "Owned status!") $Label_subs = GUICtrlCreateLabel("SUBS", 230, 573, 50, 20, $SS_CENTER + $SS_CENTERIMAGE + $SS_SUNKEN) GUICtrlSetFont($Label_subs, 7, 600, 0, "Small Fonts") GUICtrlSetBkColor($Label_subs, $COLOR_BLUE) GUICtrlSetColor($Label_subs, $COLOR_WHITE) $Input_subs = GUICtrlCreateInput("", 280, 573, 60, 20, $ES_CENTER) GUICtrlSetTip($Input_subs, "Sub-folder numbers!") ; $Button_prior = GuiCtrlCreateButton("RESTART", 10, 610, 90, 27) GUICtrlSetFont($Button_prior, 8, 600) GUICtrlSetTip($Button_prior, "Restart from the first lot of images!") ; $Checkbox_preview = GUICtrlCreateCheckbox("Preview Image", 12, 640, 90, 20) GUICtrlSetTip($Checkbox_preview, "Show larger image preview!") ; $Button_next = GuiCtrlCreateButton("NEXT", 110, 610, 60, 50) GUICtrlSetFont($Button_next, 9, 600) GUICtrlSetTip($Button_next, "View the next lot of images!") ; $Button_fld = GuiCtrlCreateButton("D", 180, 610, 50, 50, $BS_ICON) GUICtrlSetTip($Button_fld, "Open the images folder!") ; $Button_inf = GuiCtrlCreateButton("Info", 240, 610, 50, 50, $BS_ICON) GUICtrlSetTip($Button_inf, "Viewer Information!") ; $Button_quit = GuiCtrlCreateButton("EXIT", 300, 610, 50, 50, $BS_ICON) GUICtrlSetTip($Button_quit, "Exit / Close / Quit the window!") Well I would mean that mine is very clear and well defined compared to yours.
    1 point
  8. TheDcoder

    Kobo Cover Fixer

    Can we switch to TABs already? This post perfectly exhibits all of the issues with using spaces. With TABs people can set the amount of indentation they prefer and it will work for ALL tabs.
    1 point
  9. Gianni

    IsArrayEmpty

    Hi @jguinch regardless of nested arrays, what I mean is that the script you posted above doesn't seem to work as it is if we want to implement that "paradigm", then this script seems to work. (by the way, this also works with nested arrays) (p.s. I hope there are no bugs here... 😀) Further interesting reading about this topic: https://codegolf.stackexchange.com/questions/79609/index-of-a-multidimensional-array https://codegolf.stackexchange.com/questions/37905/mixed-base-conversion ...As mentioned in a comment in the first of above links: "Indexing a multidimensional array is essentially mixed base conversion" p.s. ... I forgot to give credit. The mathematics behind the script is by @Nine from this topic: https://www.autoitscript.com/forum/topic/206284-mixed-base-conversion-coding-challenge/ _Example() Func _Example() Local $aExampleArray[2][3][4] = [[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]], [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0]]] Local $aExampleArray1[2][3][4] = [[["Hello", "", "", ""], ["", "", "", ""], ["", "", "", ""]], [["", "", "", ""], ["", "", "", ""], ["", "", "", ""]]] $aExampleArray[1][2][3] = $aExampleArray1 ; <-- here I inject a nested array MsgBox(0, "Example", "Is Array empty? -> " & _ArrayIsEmpty($aExampleArray)) EndFunc ;==>_Example ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ArrayIsEmpty ; Description ...: Scans an entire array to check if it is "empty" ; Syntax ........: _ArrayIsEmpty(Byref $aInput) ; Parameters ....: $aInput - [in] an array ; ; Return values .: Success - True or False (depending on whether empty or not empty) ; ; - If passed argument is not an array ; @error is set to 1 and returns the Null value ; ; Author ........: Gianni ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _ArrayIsEmpty(ByRef $aInput) If Not IsArray($aInput) Then Return SetError(1, 0, Null) Local $iSubscripts = UBound($aInput, 0), $aSubscripts[$iSubscripts], $sDimensions, $iSubscriptElements Local $iTotElements = 1, $sLeadingZero, $vContent, $bIsEmpty, $iDigit = -1 For $i = 0 To $iSubscripts - 1 $aSubscripts[$i] = UBound($aInput, $i + 1) $iTotElements *= $aSubscripts[$i] $sLeadingZero &= '[0]' Next For $iIndex = 0 To $iTotElements - 1 $iSubscriptElements = $iIndex $sDimensions = $iSubscriptElements ? "" : "[0]" While $iSubscriptElements ; Calculate the value of each subscript $iDigit += 1 $multiplier = $aSubscripts[$iSubscripts - Mod($iDigit, $iSubscripts) - 1] $sDimensions = "[" & Mod($iSubscriptElements, $multiplier) & "]" & $sDimensions $iSubscriptElements = Floor($iSubscriptElements / $multiplier) WEnd $iDigit = -1 $sDimensions = StringMid($sLeadingZero & $sDimensions, StringInStr($sLeadingZero & $sDimensions, '[', 0, -$iSubscripts)) $vContent = Execute("$aInput" & $sDimensions) ; ConsoleWrite("Debug: " & $sDimensions & @TAB & $vContent & @TAB & VarGetType($vContent) & @CRLF) $bIsEmpty = IsArray($vContent) ? _ArrayIsEmpty($vContent) : Not $vContent If Not $bIsEmpty Then Return False ; Is not empty Next Return True ; Is empty EndFunc ;==>_ArrayIsEmpty
    1 point
  10. There is a few ways to perform such a thing. Here one of them : #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <GuiListView.au3> Global $Test = GUICreate("Test", 554, 274, -1, -1, -1, -1) Global $list = GUICtrlCreateListView("Test", 0, 0, 542, 266, $LVS_SHOWSELALWAYS, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $WS_EX_CLIENTEDGE)) Global $item1 = GUICtrlCreateListViewItem("Test Item 1", $list) Global $item2 = GUICtrlCreateListViewItem("Test Item 2", $list) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tStruct = DllStructCreate($tagNMHDR, $lParam) If GUICtrlGetHandle($list) = $tStruct.hwndFrom And $tStruct.Code = $LVN_ITEMCHANGED Then $tStruct = DllStructCreate($tagNMLISTVIEW, $lParam) ConsoleWrite("Item selected : " & _GUICtrlListView_GetItemText($list, $tStruct.item) & @CRLF) ConsoleWrite("Is checked : " & _GUICtrlListView_GetItemChecked($list, $tStruct.item) & @CRLF) EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
    1 point
×
×
  • Create New...