Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #SingleInstance Force
- Gui, Add, ListBox, vMyListBox r10 gRemoveDup, Red|Green|Blue|Red|Green|Green|Yellow|Red|Purple
- Gui, Add, Button, x+5 yp, Remove Duplicates
- Gui, Show, h200 w350, Remove Duplicates
- RemoveDup:
- Gui, Submit, NoHide
- ; Create a variable to store the unique strings
- unique_strings := []
- Loop, % MyListBox.MaxIndex()
- {
- string := MyListBox[A_Index]
- string:=StringLower (string)
- ; Check if the current string is not already in the array
- if (!unique_strings.HasKey(string))
- {
- ; If not, add it to the array
- unique_strings[string] := true
- }
- }
- ; Clear the list box
- GuiControl, , MyListBox,
- ; Loop through the array and add all the unique strings back to the list box
- Loop, % unique_strings.MaxIndex()
- {
- GuiControl, , MyListBox, % A_Index
- }
- return
- GuiClose:
- ExitApp
- Gui, Show, h200 w350, Remove Duplicates
Advertisement
Add Comment
Please, Sign In to add comment