Jump to content

Search the Community

Showing results for tags 'sorting'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 10 results

  1. Hi and Hello from a Noob..:-) i have a very weird problem. I fill up a 2d array with a)numbers and b)letters from A-Z, so 2 columns. This works absolutely perfect. But as soon as i try to sort them (numbers ascending) the array ends up in some kind of "String-sortation". What exactly am i doin wrong? To make it easy, i post below the piece of code, which i am talking about. Hope that someone can help me out. Func Analyse() Local $BasisArray[0] Local $aFill = "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" _ArrayAdd ($BasisArray, $afill) Local $FreqArray[0][2]=[[]] $row = 0 For $i = 0 to 25 $fummel = _ArrayToString ($BasisArray, ":" , $row, $row) $readout = _GUICtrlRichEdit_GetText ($hRichEdit) $anzAs = stringreplace ($readout, $fummel, $fummel) $extended = @extended $FreqFill = $extended & "|" & $fummel _ArrayAdd($FreqArray, $FreqFill) $row = $row + 1 Next _ArrayDisplay($FreqArray, "2D - Item delimited") _ArraySort($FreqArray) _ArrayDisplay($FreqArray, "bla") Thanks for helping me, Cheers, Patrick
  2. Hello everyone, How can I display in ascending sequence some numbers stored in a string variable? $str = "18,03,48,23" MsgBox(0,"test",$str) I would like it to display "03,18,23,48"
  3. How to use _Excel_RangeSort to sort my excel file by three different headers Column A1, B1, and C1 have headers on which I want to sort by. The headers on which I want to sort are department, employee type, and name. I still really new to AutoIt so I do not actually know how to properly start this line or lines of code, to be honest. The example code is the best I can do. _Excel_RangeSort($OpenWorkbook, Default, "A1:C1", "1:1", $xlDescending, Default, $xlYes, Default, $xlSortRows) I just need to sort by those three headers in that order of department, employee type, and name, plus in descending order. any and all help would be greatly appreciated. Thank you!
  4. So I've made this script that detects how long i have held down my left mouse button for and stores the information in an array and then sorts its using _ArraySort but the output is half sorted half broken. Here's my script: HotKeySet("{F1}","_exit") #include <Misc.au3> #include <Timers.au3> #include <Array.au3> Local $dll = DllOpen("user32.dll") $on = False Global $array[0] While(1) If _IsPressed(01,$dll) Then $timer = _Timer_Init() While _IsPressed(01,$dll) Sleep(1) WEnd $time = _Timer_Diff($timer) _ArrayAdd($array,"Time: " & Floor($time) & " ms") ;~ ConsoleWrite("Time: " & Floor($time) & " ms" & @CRLF) EndIf Sleep(50) WEnd Func _exit() _ArraySort($array) _ArrayDisplay($array) Exit EndFunc And the output: See how its not sorted? What is the problem here?
  5. Hi, i'm just curious is there a way to sort an ini file after largest first? my inifiles writes itself like this 14=500 13=GREY 12=500 11=600 10=600 9=600 8=700 7=700 5=600 3=600 2=800 1=700 15=GREY 4=GREY but is there a way so i can get it sortet 15 14 13 12 etc?
  6. Hi everybody, i have a question related to strings items in an Array and sorting. Maybe someone can advice me how to solve the issue. I have an Array of strings, every item of the Array is as following: INFO [13.06.2017 11:48:01] [Thread-13] [ConGenImpUsb -> waitForConnection] INFO [07.06.2017 08:55:44] [main] MDU5 - Ver 5.1x I want to sort the item in the array by date and time, is there any function which allows me to sort by date/time? Thanks in advance
  7. This algorithm is loosely based on the Approximate Counting algorithm. After the user is prompted for a starting number, a "virtual coin flip" is performed. The numbers are then put in order from least to greatest. This is great for sorting. SmartCounting.au3
  8. I was reading the Helpfile on both GUICtrlRegisterListViewSort and _GUICtrlListView_SimpleSort, and after running my script, I was initially satisfied with the way columns are sorted when the user clicks on the column header. But at certain occasions, clicking on the column header to sort numbers - integers in particular - seem to have some unexpected behaviour. I cannot verify if it is due to the way I wrote the script, or because the functions used in AutoIt to sort numbers intentionally work the way they do. Example: Column ID | Item ID | Item Name | Date 1 | ID_1 | One | 14/05/2014 2 | ID_2 | Two| 14/05/2014 3 | ID_3 | Three| 14/05/2014 10 | ID_4 | Four| 14/05/2014 9 | ID_5 | Five| 14/05/2014 27 | ID_6 | Siz| 15/05/2014 When the user clicks Column ID, logically the order of ascending sorting would look like this: 1, 2, 3, 9, 10, 27 But what I got is like this: 1, 10, 2, 27, 3, 9 Does anyone know the reason behind the way it is sorted this way? How then do I get the columns to be sorted correctly when the user clicks the column header? (I did read across other related threads like and ) I attached my codes here to see if I might write them wrongly. My code for generating ListView: $inventoryList = GUICtrlCreateListView("ID|item id|item name| Date", 45, 140, expandGUIX(750), expandGUIY(450), $LVS_REPORT, BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE)) _GUICtrlListView_SetColumnWidth(-1, 3, 651) $hInventoryList = GUICtrlGetHandle($inventoryList) For $i = 0 To 3 _GUICtrlListView_SetColumnWidth($inventoryList, $i, $LVSCW_AUTOSIZE_USEHEADER) Next My code for auto-resizing columns: Func resizeColumns($hWnd, $listView, $iColumns, $iGUI_Width, $iGUI_Height) ; Check top index - if not 0 then we have a scroll bar so increase ListView width Local $iScroll_Allowance If _GUICtrlListView_GetTopIndex($listView) > 0 Then $iScroll_Allowance = 17 EndIf ; Determine ListView width Local $iLV_Width = $iScroll_Allowance Local $iData_Width, $iHeader_Width Local $i = 0 For $i = 0 To $iColumns - 1 ; Size column to fit header _GUICtrlListView_SetColumnWidth($listView, $i, $LVSCW_AUTOSIZE_USEHEADER) $iHeader_Width = _GUICtrlListView_GetColumnWidth($listView, $i) ; Now size column to fit data _GUICtrlListView_SetColumnWidth($listView, $i, $LVSCW_AUTOSIZE) $iData_Width = _GUICtrlListView_GetColumnWidth($listView, $i) ; If header is wider, reset width If $iHeader_Width > $iData_Width Then _GUICtrlListView_SetColumnWidth($listView, $i, $iHeader_Width) $iLV_Width += $iHeader_Width Else $iLV_Width += $iData_Width EndIf Next ; Resize ListView and GUI to fit data ControlMove($hWnd, "", $listView, 10, 10, $iLV_Width + 10, $iGUI_Height - 20) ; Add 10 for internal ListView borders EndFunc ;==>resizeColumns My code for locking users from resizing columns after auto-resize: Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Get details of message Local $tNMHEADER = DllStructCreate($tagNMHEADER, $lParam) ; Look for header resize code $iCode = DllStructGetData($tNMHEADER, "Code") Switch $iCode Case $HDN_BEGINTRACKW ; Prevent resizing Return True Case $LVN_COLUMNCLICK ; Sort column $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) $iCol = DllStructGetData($tInfo, "SubItem") _GUICtrlListView_SimpleSort($cListView, $g_bSortSense, $iCol) EndSwitch Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY
  9. I recently managed to make a ListView sort correctly by clicking on it's columns, it does sort items very well but there's a very annoying thing >_< : every time after the items are sorted out, an item gets focused ! After I click a column, one item gets blue'd, like when its selected, even if its not ! Note that this happens only becuase of this function : _GUICtrlListView_SimpleSort Instead, the _GUICtrlListView_SortItems function is not doing this , but because of my luck,I must use _GUICtrlListView_SimpleSort ( but it is faster ) Here's my script to test to see what I mean: #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> $Form1 = GUICreate("Form1", 383, 307, 192, 124) $ListView1 = GUICtrlCreateListView("C1|C2|C3", 56, 16, 257, 241) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) $ListView1_0 = GUICtrlCreateListViewItem("1|5|6", $ListView1) $ListView1_1 = GUICtrlCreateListViewItem("2|7|8", $ListView1) $ListView1_2 = GUICtrlCreateListViewItem("3|9|10", $ListView1) $ListView1_3 = GUICtrlCreateListViewItem("4|11|12", $ListView1) GUISetState(@SW_SHOW) Global $toggle = 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ListView1 _GUICtrlListView_SimpleSort($ListView1, $toggle, GUICtrlGetState($ListView1)) EndSwitch WEnd How could I get rid of this item focus ?
  10. How can I do to, when I click on on a specific column in a listview control, instead to get clicked/sorted other column. Is this possible ? I already know how to sort a column when I click on it : after the listview control was created, I add this code : _GUICtrlListView_RegisterSortCallBack(-1) I know that a gui can wait for a window event to happen, like a click on a control, but how can this be done to look if I clicked on a specific column and if so then, to sort (a clasic sort ) other column instead o.O ?
×
×
  • Create New...