The help text for the _ArrayDisplay function says: "Clicking on a column header sort it."
I'm wondering why the sorting of hex numbers (specifically window handles like 0x12345678) is so wonky.
#include <Array.au3> Local $aList = WinList() _ArrayDisplay($aList) Clicking on the Col1 header to sort by window handle doesn't properly sort the list.
As a workaround, I'm sorting the array by window handle before displaying it using _ArraySort. But I still wonder what's up with the ListView sorting.
#include <Array.au3> Local $aList = WinList() _ArraySort($aList, 0, 1, 0, 1) _ArrayDisplay($aList)
I have a small script that checks if users from certain security groups exist or are disabled in AD.
For $j = Ubound ( $Users, 1 ) -1 To 0 Step -1 Switch _AD_IsObjectDisabled ( $Users[$j] ) Case 1 ClipPut ( $Users[$j] & " - account disabled; " ) Case 0 If @error = 1 Then ClipPut ( $Users[$j] & " - account not found; " ) Else ClipPut ( $Users[$j] & " - Ok; " ) EndIf EndSwitch $Clip = $Clip & @CRLF & ClipGet () Next $Data[$O] = $Clip The code works correctly, at the end I have a 2D array $Data with security group in column 1 and checked user accounts in columns 2. However, _ArrayDisplay ( $Data ) shows users in one row, despite I added @CRLF. When I write $Clip to a text file, user accounts are written as column. Isn't it possible to have multiple-line cell split by @CRLF in _ArrayDisplay?
_ArrayDisplay($aArray, "Window Title", "1:", 0, Default, "Column") ; Expected results are rows 1 to the end of the array, all columns. The result is rows 0-1, all columns. The API reference is here:
Am I doing something wrong?
I have a little problem in one of my function/functions. Here is my code:
Func IsVisible($handle) If BitAND(WinGetState($handle), 4) Then ;If Not BitAND(WinGetState($handle), 16) Then If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndIf EndFunc ;==>IsVisible Func _GetWindows() ; Global $i = 12 ;Local $anumber = 0 / or use &i? Dim $VisibleWindows = [["0", ""]] $AllWindows = WinList() For $i = 1 To $AllWindows If IsVisible($AllWindows[$i]) Then If $AllWindows[$i] <> "" And $AllWindows[$i] <> "Program Manager" Then ReDim $VisibleWindows[UBound($VisibleWindows) + 1] $VisibleWindows = $VisibleWindows + 1 $VisibleWindows[($VisibleWindows)] = $AllWindows[$i] $VisibleWindows[($VisibleWindows)] = $AllWindows[$i] EndIf Else EndIf Next _ArrayDisplay($VisibleWindows, "Visible Windows") ;If WinClose("Visible Windows", "") = 1 Then Idle() EndFunc ;==>_GetWindows This should display all windows and their respective handels that WinList function can find, and display it in a "Visible Windows" titled arraydisplay. All good there, script runs as expected. I copied the code for the _GetWindows() from here, and implemented it with minimal changes as I recall (sorry I found it more then a month ago).
My problem is that If I try to close the "Visible Windows" Window, the script just reopens anotherone, basicly the only thing I can do is terminate the script somehow after I started to display this. I'm pretty sure that there is something small that I miss, but since I can't really bend my mind around the _GetWindows array creation, I can't really pinpoint why it opens it again when I close it.
(I try to used WinClose but thats just stupid since there is noproblem with closing, the problem is the reopening, realized that while I was writing it)
Thank you for your help!
Hi, Please look at the code below:
#include <File.au3> #include <Array.au3> ; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ; #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiButton.au3> #include <GuiListView.au3> Global $hGUI = GUICreate("GUIx",283,120,-1,-1,-1,-1) GUISetBkColor(0xFFFFFF,$hGUI) $hListX = GUICtrlCreatelistview("ColumnX|ColumnY|ColumnZ",4,4,269,65,4,544) ; GUICtrlCreatelistview("ListX",7,4,269,65,-1,512) GUICtrlSetData(-1, "ColumnX|ColumnY|ColumnZ") $hButtonY = GUICtrlCreateButton("ButtonY",20,80,100,30,-1,-1) $hButtonZ = GUICtrlCreateButton("ButtonZ",160,80,100,30,-1,-1) GUISetState() While True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hButtonY AddRows() EndSwitch WEnd Func AddRows() Local $aFiles = _FileListToArray(@ScriptFullPath & '\FolderX', Default, Default, True) _ArrayDisplay($aFiles) Local $aContent For $i = 0 To UBound($aFiles) - 1 MsgBox(0, "", $aFiles) $aContent = FileReadToArray($aFiles[$i]) Next For $i = 0 To UBound($aContent) - 1 Step 3 GUICtrlCreateListViewItem($aContent[$i] & '|' & $aContent[$i + 1] & '|' & $aContent[$i + 2], $hListX) Next EndFunc _ArrayDisplay at line no. 33 is not working, I don't know what is happening...
Thanks in Advance, TD
P.S Actually the code was for another question but while debugging the code, I encountered this problem