Paulie Posted May 19, 2006 Share Posted May 19, 2006 This is a simple GUI that allows for input of text arrays of any size, then organizes each alphabeticaly. Allows for both Ascending and Descending sorts. expandcollapse popup;---Include--- #Include <GUIConstants.au3> #Include <Array.au3> ;== ;---Variables--- Global $Button_[2], $Label_[5], $Edit_[2], $Combo_[1], $text ;== ;---Build GUI--- $win1 = GUICreate("Alphabetizer", 700, 700, -1, -1, BitOr($WS_EX_TOPMOST, $WS_EX_APPWINDOW)) $Combo = GUICtrlCreateCombo ("A-Z", 600,50, 75, 50, -1) GUICtrlSetData(-1,"Z-A") $Label_[0] = GUICtrlCreateLabel("Order to sort:", 525, 50, 75, 50, -1) $Label_[1] = GUICtrlCreateLabel("Alphabetizer", 50, 50, 400, 100, -1) GUICtrlSetFont (-1,40, 600, 6, "Veranda") $Edit_[0] = GUICtrlCreateEdit("Use a "","" to separate words.", 50, 300, 225, 350) $Label_[2] = GUICtrlCreateLabel("Input:", 50, 260, 75, 40, -1) $Edit_[1] = GUICtrlCreateEdit("", 280, 300, 225, 350) $Label_[3] = GUICtrlCreateLabel("Result:", 280, 260, 75, 40, -1) $Button_[0] = GUICtrlCreateButton("Sort", 550, 400, 75, 40, -1) $Button_[1] = GUICtrlCreateButton("Cancel", 550, 465, 75, 40, -1) $Label_[4] = GUICtrlCreateLabel("By: Paulie", 25, 150, 75, 40, -1) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Button_[1] then ExitLoop If $msg = $Button_[0] then $Combo1 = GuiCtrlRead($combo) If $Combo1 = "A-Z" then SortAsc() Else SortDes() Endif Endif Wend Func Sortasc() $read1 = GUICtrlRead($Edit_[0]) $read2 = Stringsplit($read1, ",") _ArraySort( $read2, 0, 1) for $x = 1 to $read2[0] GUICtrlSetData($Edit_[1], $read2[$x] & @CRLF, 2) Next EndFunc Func SortDes() $read1 = GUICtrlRead($Edit_[0]) $read2 = Stringsplit($read1, ",") _ArraySort( $read2, 1, 1) for $x = 1 to $read2[0] GUICtrlSetData($Edit_[1], $read2[$x] & @CRLF, 2) Next EndFunc I'd like to thank (do I really need to? isn't it understood?) Valuater for his help in the sort function Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 nice work paulie... however, maybe you could trim the size/porportion down to a smaller/sleeker looking gui with the buttons and porportions visually/astectically and functionally attractive maybe just play with guibuilder or Koda-forms just an idea 8) Link to comment Share on other sites More sharing options...
Paulie Posted May 19, 2006 Author Share Posted May 19, 2006 (edited) nice work paulie... however, maybe you could trim the size/porportion down to a smaller/sleeker looking gui with the buttons and porportions visually/astectically and functionally attractive maybe just play with guibuilder or Koda-forms just an idea 8)Ya, I would have done that before, but now its done New Code: expandcollapse popup;---Include--- #Include <GUIConstants.au3> #Include <Array.au3> ;== ;---Variables--- Global $Button_[4], $Label_[5], $Edit_[2], $Combo_[1], $text ;== ;---Build GUI--- $win1 = GUICreate("Alphabetizer", 400, 585, -1, -1, BitOr($WS_EX_TOPMOST, $WS_EX_APPWINDOW)) GUISetBkColor("0xCCCCCC") $Combo = GUICtrlCreateCombo ("A-Z", 275,50, 75, 50, -1) GUICtrlSetData(-1,"Z-A") $Label_[0] = GUICtrlCreateLabel("Order to sort:", 200, 50, 75, 20, -1) $Label_[1] = GUICtrlCreateLabel("Alphabetizer", 10, 10, 185, 40, -1) GUICtrlSetFont (-1,20, 600, 6, "Veranda") $Edit_[0] = GUICtrlCreateEdit("Use a "","" to separate words.", 10, 125, 175, 350) $Label_[2] = GUICtrlCreateLabel("Input:", 10, 100, 75, 15, -1) $Edit_[1] = GUICtrlCreateEdit("", 210, 125, 175, 350) $Label_[3] = GUICtrlCreateLabel("Result:", 210, 100, 75, 15, -1) $Button_[0] = GUICtrlCreateButton("Sort", 100, 500, 75, 40, -1) $Button_[1] = GUICtrlCreateButton("Cancel", 225, 500, 75, 40, -1) $Button_[2] = GUICtrlCreateButton("Clear", 285, 100, 75, 20, -1) $Button_[3] = GUICtrlCreateButton("Clear", 85, 100, 75, 20, -1) $Label_[4] = GUICtrlCreateLabel("By: Paulie", 50, 60, 75, 20, -1) GUICtrlSetFont (-1,9, 400, 2, "Veranda") GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $Button_[1] then ExitLoop If $msg = $Button_[0] then $Combo1 = GuiCtrlRead($combo) If $Combo1 = "A-Z" then SortAsc() Else SortDes() Endif Endif If $msg = $Button_[2] then GUICtrlSetData($Edit_[1], "","") EndiF If $msg = $Button_[3] then GUICtrlSetData($Edit_[0], "","") EndiF Wend Func Sortasc() $read1 = GUICtrlRead($Edit_[0]) $read2 = Stringsplit($read1, ",") _ArraySort( $read2, 0, 1) for $x = 1 to $read2[0] GUICtrlSetData($Edit_[1], $read2[$x] & @CRLF, 2) Next EndFunc Func SortDes() $read1 = GUICtrlRead($Edit_[0]) $read2 = Stringsplit($read1, ",") _ArraySort( $read2, 1, 1) for $x = 1 to $read2[0] GUICtrlSetData($Edit_[1], $read2[$x] & @CRLF, 1) Next EndFunc Edited May 19, 2006 by Paulie Link to comment Share on other sites More sharing options...
Valuater Posted May 19, 2006 Share Posted May 19, 2006 much cleaner looking.... nice job 8) Link to comment Share on other sites More sharing options...
Xenobiologist Posted May 19, 2006 Share Posted May 19, 2006 Hi, nice but I cannot image when to use it. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now