Jump to content

changing colors


Recommended Posts

hello

i have an existing listview which accepts drop files.  from the files dropped, i am trying to identify duplicate files by highlighting the duplicate files by the same color.  however, id like to add more colors to be able to provide a wider range of files supported.  The method i am using works but not efficient at all.  any ideas on a more efficient method?

what i have works but is very inefficient and limited to 3 colors:

$orange_used = False
    $green_used = False
    $blue_used = False

    For $x = 1 To UBound($listview_array) - 1
;~      $listview_ctrl_id = $listview_array[$x][0]
;~      $file_path = $listview_array[$x][1]
        $sha1_checksum = $listview_array[$x][2]
        $color_assigned = $listview_array[$x][3]
        
        If $color_assigned <> "" Then ContinueLoop

        $search = _ArrayFindAll($listview_array, $sha1_checksum, 0, 0, 0, 0, 2)

        If @error Then ContinueLoop

        If UBound($search) > 1 Then
;~          Debug($search)
            If $orange_used = False Then
                For $y = 0 To UBound($search) - 1
                    $orange_used = True
                    $listview_array[$search[$y]][3] = "ORANGE"
                    GUICtrlSetBkColor($listview_array[$search[$y]][0], 0xFF5733) ;ORANGE
                Next
                ContinueLoop
            EndIf

            If $green_used = False Then
                For $y = 0 To UBound($search) - 1
                    $green_used = True
                    $listview_array[$search[$y]][3] = "GREEN"
                    GUICtrlSetBkColor($listview_array[$search[$y]][0], 0x00FF00) ;GREEN
                Next
                ContinueLoop
            EndIf

            If $blue_used = False Then
                For $y = 0 To UBound($search) - 1
                    $blue_used = True
                    $listview_array[$search[$y]][3] = "BLUE"
                    GUICtrlSetBkColor($listview_array[$search[$y]][0], 0x5DADE2) ;BLUE
                Next
                ContinueLoop
            EndIf
;~          Debug($listview_array)
        EndIf
    Next

thank you in advance!

Link to comment
Share on other sites

you could have a random color generator.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

How would the color generator automatically work with the script?  Ideally I would like to have a long list of approved (by me) because some colors make text hard to read

Link to comment
Share on other sites

something like this maybe :

Global Const $aColor[] = [0xFF5733, 0x00FF00, 0x5DADE2, 0x101010]   ; a long list of approved colors (do not use 0x000000)
Global $iPtr = 0

For $x = 1 To UBound($listview_array) - 1
;~      $listview_ctrl_id = $listview_array[$x][0]
;~      $file_path = $listview_array[$x][1]
  $sha1_checksum = $listview_array[$x][2]
  $color_assigned = $listview_array[$x][3]

  If $color_assigned Then ContinueLoop

  $search = _ArrayFindAll($listview_array, $sha1_checksum, 0, 0, 0, 0, 2)

  If @error Or UBound($search) = 1 Then ContinueLoop
  If $iPtr = UBound($aColor) Then Exit MsgBox(0, "", "Increase number of colors")

  For $y = 0 To UBound($search) - 1
    $listview_array[$search[$y]][3] = $aColor[$iPtr]
    GUICtrlSetBkColor($listview_array[$search[$y]][0], $aColor[$iPtr])
  Next
  $iPtr += 1
Next

untested...

Link to comment
Share on other sites

I was thinking about a random thing, more like this:

"0x" & Hex(Random(1, 255, 1) & Random(1, 255, 1) & Random(1, 255, 1), 6)&@CRLF)

but if pre-setting the colors works for you, it works for me.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...