Leaderboard
Popular Content
Showing content with the highest reputation on 07/11/2013 in all areas
-
New ternary operator - Discussion
jaberwacky and 2 others reacted to trancexx for a topic
Ternary is particularly useful when declaring constants. This goes for any language that has ternary. When dealing with const references even more. For example in AutoIt you would use ternary good if you would do this: Const $MY_SUPER_MEANINGFUL_CONST = @AutoItX64 ? "Bzz" : "Hrr" ;... ...Try without ternary and see what you get.3 points -
Hi, Re Mat's comments in post #9 about some _Array* functions not working with empty arrays, I have just submitted a revised Array.au3 UDF which should resolve the problems. So please wait for the next Beta before commenting further on any empty array hiccups - then you can moan at me if it still does not work. M232 points
-
GUIListViewEx - Deprecated Version
123disconnect reacted to Melba23 for a topic
Now replaced by a new version of the UDF in this link. <hr> [NEW VERSION] - 7 Mar 16 Added: A new option for $iAdded (+ 512) allows you to select just one cell of the ListView rather than the whole row. A new function _GUIListViewEx_SetDefColours allows the user to set the default colours when using either or both the "colour" and "single cell selection" options. Another new function _GUIListViewEx_BlockReDraw which prevents ListView redrawing during looped Insert/Delete/Change calls - this greatly speeds up execution by avoiding lengthy redrawing when using either or both the "colour" and "single cell selection" options, use of which forces the redraw to use a WM_NOTIFY handler within the script. Changed: A number of minor internal changes to speed up the loading of the ListView when using either or both of the "colour" and "single cell selection" options. A slightly modified Example_6 script shows the new functions in use. The LH native ListView can have rows and columns added/removed using both the old and new functions and has a context menu to allow for colour selection. The contents of this ListView can be mirrored to the RH UDF-created ListView which has "single cell selection" enabled and allows the colours of any item (including the selected cell) to be changed programmatically. New UDF in the zip below. Previous changes: ChangeLog.txt Hi, It seemed that I wanted to add, delete, edit or move items in a ListView quite often in my scripts and I got fed up with having to rewrite the code to do it each time. I also wanted to be able to drag items within and between ListViews with the mouse, plus edit the items. So I decided to write a UDF to make life easier and here is the result - GUIListViewEx. If you are interested in how it works, then read this bit - if not, then skip over it: The UDF is pretty easy to use: - You start by creating a ListView (either native or UDF) and passing the returned ControlID/handle and the array you used to fill it to the _Init function of the UDF. You also indicate whether the array has a count in the [0] (or [0][0]) element and if you create an empty ListView, the UDF will still cope and will shadow any items that you insert later. If you have a ListView filled with data but no matching array, there is a function to read that data into an array for you. You can select a colour for the insert mark when dragging items if you are going to use this feature - the default is black - and decide whether to have a shadow of the dragged item follow the mouse. Finally you can set the ListView to be sortable, editable - with various options to determine how the editing process works, determine external drag/drop behaviour and whether user colours are used. - You need to register a few Windows messages, but this is a single call to the _MsgRegister function. If you already have handlers for the relevant messages, there are functions to call within these handlers instead. If you do not want to drag, then you only need the WM_NOTIFY handler loaded. - Then you just need to call the main _Insert($vData), _Delete, _Up, and _Down functions when the appropriate button is pressed, select and drag items, or use one of the edit functions and your ListView responds automatically. - The UDF shadows the contents of the ListView (as explained in the spoiler section above) so you can get its current state at any time with the _ReturnArray function . Many of the functions actually return this data after each call just to help you keep track and there are dedicated Save/Load functions. - If enabled, the user can colour individual items within the ListView - and can set certain elements to be coloured on loading if required. - There are a couple of functions that you need to run in your idle loop if you need the functionality - they detect when items are dragged and edited. - When you have finished with the ListView, you should use the _Close function to clear the memory used by the UDF to shadow its contents. It is not vital, but if you use a lot of ListViews and do not do this, you could end up running out of memory. - You can have as many ListViews as you wish on display at any one time and the same "Insert", "Delete", "Up" and "Down" buttons can be used for them all - you just have to click on the one you want to be active. The UDF also allows you to set the active ListView programatically (_SetActive) - and to determine which is currently active (_GetActive). There are also additional Insert/DeleteSpec functions which allow you to action non-active ListViews. There are 6 example scripts to show the UDF working on native and UDF created ListViews, with single or multiple columns and either filled or empty, along with the UDF itself in this zip file: Credit to martin (for the basic drag code which I found on the forum), the Array UDF authors (for the basis of the array functions) and LarsJ (for the basic colour handler code). Happy for any feedback - hopefully positive! M231 point -
Hover Window info utility & _WinGetClassnameNNList()
mesale0077 reacted to Malkey for a topic
This hover Window info utility highlights in red the control window or GUI window the mouse is hovering over. The window, mouse and control information is displayed in a tooltip. To work, the windows the mouse is over does not have to be active nor the top most window. The tooltip Displays Window info:- Title: Class: Handle: Mouse info:- Absolute position: Control info:- ClassnameNN: ID: Handle: Position: - Relative to the underlying GUI or control window; and, The absolute position which is relative to the desktop. Size: - Width, length - size in pixels of red highlighted control. ControlClickCoords: - Position relative to the top, left corner of the red highlighted control. No. of Ctrl Layers under Mouse: - The number of controls at the mouse position. Ctrl Layers ClassNN/Hndl: - List of all controls under mouse. Appears when more than one Ctrl layer. Things to know. Pressing Alt + s keys toggles reversing the detection order of the layered controls. (If a control that the mouse is hovering is not being selected but the control at the bottom of the layers is selected, then pressing the Alt+s keys may enable that topmost control to be selected.) Press Alt + UP keys when the Alt + s keys are in the "have not been pressed state". Each Alt+UP keys press selects in green the next control below the previous control for 2 secs. At the bottom of the tooltip each "Ctrl Layer" progressively climbs up from the bottom of the red highlighted control in the list. Press Alt + DOWN keys when the Alt + s keys are in the "have been pressed state". Each Alt+Down keys press selects in green, for 2 secs, the next below layered control. At the bottom of the tooltip each "Ctrl Layer" progressively decended away from the top red highlighted control in the list. Note: While scrolling up or down through the layers once if they exist, the mouse must not move. However, slightly move the mouse to scroll up or down once again. Press Alt + q keys to quit Press Alt + h keys for this help window. #include <WinApi.au3> #include <Misc.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> _Singleton(@ScriptFullPath) Global $iCtrlOrder = 1, $iLayers, $sLayersNN, $hTopControl, $iUpVal = 0, $iTTx, $iTTy Local $aMouse, $tPoint, $hWnd, $hNextWin, $windowList, $hControl, $iPosX, $iPosY, $hOldTopControl = 0, $x, $y Local $aPos, $sClassNN, $sClass, $iCount, $iId, $sCtrl, $aPos, $aWinList, $aUniqList, $iInstances, $iStart Local $aClassNNList, $tRect, $sWin, $ExitBut, $WinClass, $WinAtPtFlag HotKeySet("!h", "_Help") HotKeySet("!s", "_CtrlOrder") HotKeySet("!q", "_Exit") HotKeySet("!{UP}", "_UpLayers") HotKeySet("!{DOWN}", "_UpLayers") While 1 $tPoint = _WinAPI_GetMousePos() $x = DllStructGetData($tPoint, "x") $y = DllStructGetData($tPoint, "y") If ($x <> $iTTx Or $y <> $iTTy) Then $WinAtPtFlag = 0 $iUpVal = 0 $hWnd = _WinAPI_GetAncestor(_WinAPI_WindowFromPoint($tPoint), 2); 2 = $GA_ROOT $WinClass = _WinAPI_GetClassName($hWnd) $hNextWin = "" $hTopControl = "" ; -------- ClassNN List ------------------------------ $windowList = WinGetClassList($hWnd) ;ConsoleWrite($windowList & @LF) $aWinList = StringRegExp($windowList, "[^\v]+", 3) $aUniqList = _ArrayUnique($aWinList) ;_ArrayDisplay($aUniqList) If IsArray($aUniqList) Then For $j = 1 To $aUniqList[0] StringRegExpReplace($windowList, "(?sm)^(" & $aUniqList[$j] & ")$", "") ; The number of replacements performed is stored in @extended. $iInstances = @extended ;ConsoleWrite($aUniqList[$j] & " " & $iInstances & @LF) For $k = $iInstances To 1 Step -1 $iStart = StringInStr($windowList, $aUniqList[$j] & @LF, 2, $k) $windowList = StringRegExpReplace($windowList, "(?sm)^(.{" & $iStart - 1 & "}^" & $aUniqList[$j] & ")$", "${1}" & $k) Next Next ;ConsoleWrite($windowList & @LF & "-----------" & @LF) $aClassNNList = StringRegExp($windowList, "[^\v]+", 3) ; --------> End of ClassNN List ------------------------------ ; --------- Get all layers under Mouse ---------------- $iLayers = 0 $sLayersNN = "" For $j = 0 To UBound($aClassNNList) - 1 $hControl = ControlGetHandle($hWnd, "", $aClassNNList[$j]) ;ConsoleWrite($aClassNNList[$j] & " " & $hControl & @LF) $tRect = _WinAPI_GetWindowRect($hControl) If ControlCommand($hWnd, "", $aClassNNList[$j], "IsVisible") And _ ; Check if control is visible under mouse DllStructGetData($tRect, "Left") <= $x And DllStructGetData($tRect, "Right") >= $x And _ ; Check if control is under mouse DllStructGetData($tRect, "Top") <= $y And DllStructGetData($tRect, "Bottom") >= $y Then $sLayersNN &= @TAB & @TAB & @TAB & $aClassNNList[$j] & @TAB & $hControl & @TAB & @LF ; Add ClassnameNN & Ctrl handle to string. $iLayers += 1 ; Number of controls (layers) If $iCtrlOrder = 0 And $iLayers = 1 Then ; After Alt+s keys has been pressed, the top most control is the first control encountered. $hTopControl = $hControl $sClassNN = $aClassNNList[$j] ElseIf $iCtrlOrder <> 0 Then ; Before Alt+s keys is pressed, the top most control is the last control encountered in the For-Next loop. $hTopControl = $hControl $sClassNN = $aClassNNList[$j] EndIf #cs ; _WinAPI_GetWindow() was found not to be useful in this application. ConsoleWrite($aClassNNList[$j] & " HWNDFIRST: " & _WinAPI_GetWindow($hControl & $iCount, 0) & _ " HWNDLAST: " & _WinAPI_GetWindow($hControl & $iCount, 1) & _ " HWNDNEXT: " & _WinAPI_GetWindow($hControl & $iCount, 2) & _ " HWNDPREV: " & _WinAPI_GetWindow($hControl & $iCount, 3) & _ " OWNER: " & _WinAPI_GetWindow($hControl & $iCount, 4) & _ " CHILD: " & _WinAPI_GetWindow($hControl & $iCount, 5) & @LF) #ce ;ConsoleWrite("From Pt " & _WinAPI_WindowFromPoint($tPoint)& @LF) EndIf Next ;ConsoleWrite("-------------------" & @LF) ; -----> End of "Get all layers under Mouse" ---------------- EndIf ; ------------- Gather all info for Tooltip -------------- $sWin = ">>>>Window<<<< Press Alt+h for Help" & @LF & _ "Title:" & @TAB & WinGetTitle("[Handle:" & $hWnd & "]", "") & @LF & _ "Class:" & @TAB & $WinClass & @LF & _ "Handle:" & @TAB & $hWnd & @LF & @LF & _ ">>>>Mouse<<<< " & @LF & _ "Absolute Position: " & DllStructGetData($tPoint, "x") & ", " & DllStructGetData($tPoint, "y") & @LF _WinAPI_ScreenToClient($hTopControl, $tPoint) If $hTopControl = "" Then ; Window only - no controls under mouse. $sCtrl = "" $tRect = _WinAPI_GetWindowRect($hWnd) Else $tRect = _WinAPI_GetWindowRect($hTopControl) $iId = _WinAPI_GetDlgCtrlID($hTopControl) If $iId = 0 Then $iId = "" $aPos = ControlGetPos($hWnd, "", $sClassNN) $sCtrl = @LF & _ ">>>>Control<<<< " & @LF & _ "ClassNameNN:" & @TAB & $sClassNN & @LF & _ "ID:" & @TAB & @TAB & $iId & @LF & _ "Handle:" & @TAB & @TAB & $hTopControl & @LF & _ "Position:" & @TAB & @TAB & $aPos[0] & ", " & $aPos[1] & "; Abs:" & DllStructGetData($tRect, "Left") & ", " & DllStructGetData($tRect, "Top") & @LF & _ "Size:" & @TAB & @TAB & $aPos[2] & ", " & $aPos[3] & @LF & _ "ControlClick Coords: " & DllStructGetData($tPoint, "x") & ", " & DllStructGetData($tPoint, "y") & @LF & _ "No. of Ctrl Layers under Mouse: " & @TAB & $iLayers & @LF If $iLayers > 1 Then $sCtrl &= "Ctrl Layers ClassNN/Hnd:- " & @LF & $sLayersNN EndIf ; ----- Tooltip ---- $aPos = MouseGetPos() $iPosX = ($aPos[0] - 400) * ($aPos[0] > @DesktopWidth - 400) + ($aPos[0] <= @DesktopWidth - 400) * ($aPos[0] + 20) $iPosY = ($aPos[1] - 400) * ($aPos[1] > @DesktopHeight - 400) + ($aPos[1] <= @DesktopHeight - 400) * ($aPos[1] + 20) ToolTip($sWin & $sCtrl, $iPosX, $iPosY) ; ---> Eng of Tooltip ---- $iTTx = $x ; For "If ($x <> $iTTx Or $y <> $iTTy) Then" line @ top of While loop - Steadies tooltip display. $iTTy = $y If $hOldTopControl <> $hTopControl Then ; - Steadies red outline display. _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) ; Clears Red outline graphics. $hOldTopControl = $hTopControl EndIf _DrawtRect($tRect) EndIf Sleep(30) WEnd Func _Help() Local $myedit, $msg, $Text ToolTip("") $Text = @LF & @TAB & @TAB & @TAB & _ " Hot Keys" & @LF & @LF & _ " Press Alt + s keys toggles reversing the detection order of the" & @LF & _ " layered controls. (If a control that the mouse" & @LF & _ " is hovering is not being selected but the control " & @LF & _ " at the bottom of the layers is selected, pressing the" & @LF & _ " Alt+s keys may enable that top control to be selected.);" & @LF & @LF & _ ' Press Alt + UP keys when the Alt + s keys are in the "have not been pressed' & @LF & _ ' state". Each Alt+UP keys press selects in green the' & @LF & _ " next below layered control. At the bottom of the" & @LF & _ ' tooltip each "Ctrl Layer" progressively climbs up' & @LF & _ " from the bottom of the red highlited control in the list." & @LF & @LF & _ ' Press Alt + DOWN keys when the Alt + s keys are in the "have been pressed' & @LF & _ ' state". Each Alt+Down keys press selects in green, for' & @LF & _ " 2 secs, the next below layered control. At the bottom of" & @LF & _ ' the tooltip each "Ctrl Layer" progressively decended away' & @LF & _ " from the top red highlited control in the list." & @LF & @LF & _ " Note: While scrolling up and down through the layers, the mouse must not move." & @LF & @LF & _ " Press Alt + q keys to quit;" & @LF & @LF & _ " Press Alt + h keys for this help window." GUICreate("Help Window", 450, 450) ; will create a dialog box that when displayed is centered GUISetFont(9) $myedit = GUICtrlCreateLabel($Text, 2, 0) $ExitBut = GUICtrlCreateButton('Continue', 190, 410, 70, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Or $msg = $ExitBut Then ExitLoop WEnd GUIDelete() EndFunc ;==>_Help Func _UpLayers() Local $aLay, $iIndex, $tRect, $tRectGrn, $iUbIndx ;ConsoleWrite(@HotKeyPressed & @LF) $iUpVal += 1 $aLay = StringRegExp($sLayersNN, "\h(0x[^\s]+)", 3) If IsArray($aLay) Then $iUbIndx = UBound($aLay) - 1 $iIndex = _ArraySearch($aLay, $hTopControl) ;if $iIndex < $iUbIndx then $iIndex += $iUpVal Switch @HotKeyPressed Case "!{UP}" If $iIndex - $iUpVal >= 0 Then $iIndex -= $iUpVal Else $iIndex = 0 EndIf Case "!{DOWN}" If $iIndex + $iUpVal <= $iUbIndx Then $iIndex += $iUpVal Else $iIndex = $iUbIndx EndIf EndSwitch $tRect = _WinAPI_GetWindowRect($hTopControl) $tRectGrn = _WinAPI_GetWindowRect($aLay[$iIndex]) ;ConsoleWrite($iUpVal & " " & $aLay[$iIndex] & @LF) _DrawtRect($tRect) _DrawtRect($tRectGrn, 0x00ff00) While Sleep(2000) = 0 WEnd _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) EndIf EndFunc ;==>_UpLayers Func _CtrlOrder() If $iCtrlOrder = 1 Then ; Alt+S has not been pressed. $iCtrlOrder = 0 ; Means Alt+S has been pressed. Else $iCtrlOrder = 1 ; Alt+S is in not been pressed state. EndIf EndFunc ;==>_CtrlOrder ; Draws coloured rectangle on screen. Func _DrawtRect($tRect, $color = 0xFF, $PenWidth = 2) Local $hDC, $hPen, $obj_orig, $x1, $x2, $y1, $y2 $x1 = DllStructGetData($tRect, "Left") $x2 = DllStructGetData($tRect, "Right") $y1 = DllStructGetData($tRect, "Top") $y2 = DllStructGetData($tRect, "Bottom") $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop) $hPen = _WinAPI_CreatePen($PS_SOLID, $PenWidth, $color) $obj_orig = _WinAPI_SelectObject($hDC, $hPen) _WinAPI_DrawLine($hDC, $x1, $y1, $x2, $y1) ; horizontal to right _WinAPI_DrawLine($hDC, $x2, $y1, $x2, $y2) ; vertical down on right _WinAPI_DrawLine($hDC, $x2, $y2, $x1, $y2) ; horizontal to left right _WinAPI_DrawLine($hDC, $x1, $y2, $x1, $y1) ; vertical up on left ; clear resources _WinAPI_SelectObject($hDC, $obj_orig) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) EndFunc ;==>_DrawtRect Func _Exit() _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) Exit EndFunc ;==>_Exit Comments One thing I have discovered using this tool was in Internet Explorer. The "AutoIt v3 Window Info" tool shows the IE address bar as ClassnameNN: ToolbarWindow322. This Hover Window Info tool also shows the IE address bar as ClassnameNN:ToolbarWindow322 with six layers of controls. Pressing Alt+Up Arrow keys the next control above the ToolbarWindow322 control in the tooltip list, "Edit1", was highlighted in green and appeared inside the ToolbarWindow322 control. So, ControlGetText("[Class:IEFrame]","","Edit1") returned the address from Internet Explorer's address bar. This tool is of no use in Firefox. I could not find any window controls in the Mozilla Firefox window. The AutoIt Help file made a good test window. ZOrder.au3 This test GUI, "ZOrder.au3", was used to scroll up or down the layered control. I came across some layered controls which would only highlight the bottom most layer on the screen which was the top most control in the list on the tooltip. I found by reversing the layer selection in the list from top to bottom (by pressing Alt+s keys) this info tool worked correctly on the layered controls. And Alt+Down also worked to scroll down through the layered controls. The top control of the tooltip list being the red highlighted control. In the test "ZOrder" window this is how the left side works - Alt+s needs to be pressed. For normal selection of the screen's top most control which appears at the bottom of the tooltip list, Alt+s need not be press. If Alt+s is press, Alt+s needs to be pressed again to return to normal mode which is as though Alt+s had never been pressed. The right side of the test "ZOrder" window does not need Alt+s pressed. Alt+Up is used to scroll up through the list of layered controls on the tooltip. The bottom control of the tooltip list being the red highlighted control. #include <WindowsConstants.au3> #include <EditConstants.au3> Local $Button_1, $myedit1, $myedit2, $myedit3, $myedit4, $myedit5, $myedit6, $myedit7, $myedit8, $Button_2, $label GUICreate("ZOrder Test GUI ", 650, 650, -1, -1) ;GUISetBkColor(0xE0FFFF) $Button_1 = GUICtrlCreateButton("First Control declared - $WS_EX_TOPMOST", 45, 250, 220, -1, -1, $WS_EX_TOPMOST) $myedit1 = GUICtrlCreateEdit("First Edit declared - $WS_EX_TOPMOST" & @CRLF, 120, 120, 180, 300, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL), BitOR($WS_EX_TOPMOST, $WS_EX_STATICEDGE)) $myedit2 = GUICtrlCreateEdit("Second Edit declared - $WS_EX_TOPMOST" & @CRLF, 80, 80, 220, 400, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL), BitOR($WS_EX_TOPMOST, $WS_EX_STATICEDGE)) $myedit3 = GUICtrlCreateEdit("Third Edit declared - $WS_EX_TOPMOST" & @CRLF, 40, 40, 260, 500, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL), BitOR($WS_EX_TOPMOST, $WS_EX_STATICEDGE)) $myedit4 = GUICtrlCreateEdit("Forth Edit declared - $WS_EX_TOPMOST" & @CRLF, 2, 2, 298, 600, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL), BitOR($WS_EX_TOPMOST, $WS_EX_STATICEDGE)) $myedit5 = GUICtrlCreateEdit("Fifth Edit declared" & @CRLF, 327, 2, 298, 600, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL), $WS_EX_STATICEDGE) $myedit6 = GUICtrlCreateEdit("Sixth Edit declared" & @CRLF, 365, 40, 260, 500, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL), $WS_EX_STATICEDGE) $myedit7 = GUICtrlCreateEdit("Seventh Edit declared" & @CRLF, 405, 80, 220, 400, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL), $WS_EX_STATICEDGE) $myedit8 = GUICtrlCreateEdit("Eighth Edit declared" & @CRLF, 445, 120, 203, 300, BitOR($ES_AUTOVSCROLL, $WS_VSCROLL), $WS_EX_STATICEDGE) $Button_2 = GUICtrlCreateButton("Last Control declared", 370, 250, 180, -1, -1) $label = GUICtrlCreateLabel('The LHS (Left Hand Side) controls of this window are not detected by the "Hover for Info" script nor the "Au3Info" utility.' & _ ' By pressing the Alt+S keys while the "Hover for Info" script is running enables detection of the LHS controls and not the RHS controls. ' & _ ' Press the Alt+S keys again to detect the RHS controls again.', 50, 606, 550, 44) GUISetState() While GUIGetMsg() <> -3 WEnd _WinGetClassnameNNList function This _WinGetClassnameNNList function I thought would compliment the _WinGetClassList. The array of all the ClassnameNNs from a window using _WinGetClassnameNNList() are in the same order as the list of Classes from the same window using _WinGetClassList(). #include <Array.au3> Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase ;Local $Process = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe" ;Local $Process = "ZOrder.exe" Local $Process = "Calc.exe" Local $sTitle = StringRegExpReplace($Process, "(^.*\\)|(\..*$)", "") ;ConsoleWrite($sTitle & @LF) Local $PID = Run($Process) WinActivate($sTitle) Local $hWnd = WinWaitActive($sTitle, "", 3) Local $sWindowList = WinGetClassList($hWnd) ConsoleWrite($sWindowList & @LF) Local $aCNN = _WinGetClassnameNNList($hWnd) _ArrayDisplay($aCNN, "ClassnameNN List") If $PID Then ProcessClose($PID) ; Returns an array of all ClassnameNNs of a window in the same order as the classes are returned using WinGetClassList(). Func _WinGetClassnameNNList($hWnd) Local $aWinList, $aUniqList, $iInstances, $k, $i, $iStart, $sUniqTestStr Local $sWindowList = WinGetClassList($hWnd) ; Window's string of classes list. ;ConsoleWrite("---- Class ----" & @lf & $sWindowList & @LF) $aWinList = StringRegExp($sWindowList, "[^\v]+", 3) If @error = 1 Then MsgBox(1, "Error", "Window has no controls", 2) Return EndIf ; ---- Routine instead of _ArrayUnique() ----- $sUniqTestStr = @LF & $aWinList[0] & @LF For $i = 1 To UBound($aWinList) - 1 If StringInStr($sUniqTestStr, @LF & $aWinList[$i] & @LF, 2) = 0 Then $sUniqTestStr &= $aWinList[$i] & @LF ; A string of unique classes EndIf Next ;ConsoleWrite($sUniqTestStr & @LF) $aUniqList = StringRegExp($sUniqTestStr, "([^\v]+)", 3) ; An array of unique classes ; ----> End of Routine instead of _ArrayUnique() ----- For $j = 0 To UBound($aUniqList) - 1 StringRegExpReplace($sWindowList, "(?sm)^(" & $aUniqList[$j] & ")$", "") ; The number of replacements performed is stored in @extended. $iInstances = @extended ;ConsoleWrite( $aUniqList[$j] & " " & $iInstances & @LF) For $k = $iInstances To 1 Step -1 $iStart = StringInStr($sWindowList, $aUniqList[$j] & @LF, 2, $k) $sWindowList = StringRegExpReplace($sWindowList, "(?sm)^(.{" & $iStart - 1 & "}^" & $aUniqList[$j] & ")$", "${1}" & $k); Append instance to class in Window's string of classes list. ;ConsoleWrite("(?s)^(.{" & $iStart - 1 & "}" & $aUniqList[$j] & ")" & @lf & $sWindowList & @LF) Next Next ;ConsoleWrite("-- ClassnameNN --" & @lf & $sWindowList & @LF) Return StringRegExp($sWindowList, "[^\v]+", 3) ; Return an array of ClassnameNNs. EndFunc ;==>_WinGetClassnameNNList1 point -
AutoIt v3.3.9.6 Beta
jaberwacky reacted to Jon for a topic
File Name: AutoIt v3.3.9.6 Beta File Submitter: Jon File Submitted: 10 Jul 2013 File Category: Beta Other Downloads Most of the changes to the main AutoIt code by trancexx. Most of the UDF and helpfile changes by the MVPs, Thanks Note: Although the feature set is roughly correct, things may be added or removed so please treat this very much as a work in progress. There are constant "discussions" ongoing in the MVP forum about the best way to do things 3.3.9.6 (10 July, 2013) (Beta) AutoIt: - Added: Interpreter accepts 64bit hex numbers. - Added: Keyword Null. - Added #488: Third parameter for ObjGet() function to specify object instance. - Added: Compound assignment operators for object properties. - Added #1191: Explicit size of arrays optional for explicit initialization. - Added: Array access on expression: StringSplit("a,b", ",")[1] - Added: Dot access on expression: ObjCreate("Shell.Application").GetSystemInformation("DirectoryServiceAvailable") - Added: Empty arrays. - Added: Functions are now first class objects which means variables can "point" to them and the function can be called through the variable. - Added: Built-in functions that take a callback now be passed directly in addition to the old method of passing as a string. Built-in functions can also be passed now (be careful that the function you pass matches what the caller expects). - Added: C++ style ternary operators: Local bResult = ("foo" = "bar") ? True : False - Added: Expression as default function parameter. - Added: With...EndWith can be used on expressions having dot-access. - Added: Nested "With...EndWith". - Added: Call calls built-in functions. - Added: ByRef with call function. - Added: Support for more COM VARIANT types. - Changed: Removed Windows 2000 support. Minimum supported OS is now Windows XP RTM / Windows Server 2003. - Changed: upx.exe from 3.07 -> 3.09. - Changed: PCRE regular expression engine updated to 8.33. - Changed: ReDim works on arrays declared as static. - Changed: Run-time errors on objects no longer fatal (execution of the script is not halted). - Changed: Allowing multiple COM Error Handlers. Last one registered and alive gets called. - Changed: VT_NULL VARIANT converts to Null keyword (previously empty string). - Fixed #2067: -2147483648 not stored as int32. - Fixed #2003: ProcessWaitClose() using too much CPU. - Fixed #2076: COM VARIANT not correctly set for boolean True. - Fixed #2015: DllCallbackRegister() mangles floating point numbers under x64. - Fixed: x64 DllCall not setting double type parameters correctly. - Fixed: DllCallbackRegister() not returning floating point types correctly. - Fixed: Different issues with Static keyword. - Fixed #2078: Error in com expression. - Fixed #2073: Unexpected termination with ContinueLoop. - Fixed #1485: Unexpected termination with ContinueCase. - Fixed: Crash in ObjEvent() for ByRef object parameters. - Fixed #2068: Repeated calls to Acos() no longer produce strange results. NOTE: This fix increases the size of AutoIt by approximately 60KB. - Fixed: ObjGet() fails validating class identifier properly when first parameter for the function is specified. - Fixed #2111: RunAs() could fail even if a user had the correct permissions to use it. - Fixed #1395: DLLCallbacks on Exit. - Fixed: Ptr() returns null pointer for objects. - Fixed #1319: Hang at exit for RichEdit user controls. - Fixed #2138: Fixed GUICtrlRead() on dummy controls was corrupting strings and possibly crashing AutoIt. - Fixed #1760: #OnAutoItStartRegister ignores single quoted function names. - Fixed #2146: Crash when closing AutoIt when started from a console window. - Fixed: DLLStruct type forgotten in comparison operations. - Fixed: "struct" type parameter in DllCall overwrites possibly following parameters. - Fixed #1566: Array as its own element issue. - Fixed #1551: Crash the script when changing array. - Fixed: ReDim allows initialization to non-array. - Fixed #2166: StringToASCIIArray() and StringFromASCIIArray() did not correctly return an empty string when the start index is greater than the end index. - Fixed #1901: 32-bit compiled scripts now work from the system32 directory on 64-bit Windows. - Fixed #2157: ProcessList() would crash if there were more than 512 running processes. - Fixed #2215: Bad syntax check for default function parameters. - Fixed #2222: Non-ASCII characters not allowed in object properties/methods. - Fixed #2235: ProcessGetStats() defaulted to using the current process if an invalid process was specified. - Fixed #2253: Ping() returns success with no connection. - Fixed #1498: #RequireAdmin endless loop for disabled UAC. UDFs: - Added: _WinAPI_GetProcAddress() function. - Added #2126: Documentation remark about _ArrayDisplay being able to display a maximum of 65530 items. - Added #1158: WinAPIEx integrated, splitted under WinAPI*.au3. - Added #2250: DirMove to the related section of DirCopy. - Added #2155: Missing documentation for the default working directory of Run/RunWait. - Added #2224: Optional parameter to _FileReadToArray to return the array count in the first element. - Added #2114: Disabling and enabling the redrawing message to increase the speed of displaying _ArrayDisplay. (Only noticeable on large arrays.) - Added #2120: Disabling and enabling the redrawing message to increase the speed of deleting items with _GUICtrlListView_DeleteAllItems. (Only noticeable when deleting many items in a ListView.) - Added #966: Optional parameter to return the full path of the file/folder in _FileListToArray. - Added #2193: _StringTitleCase, to create a title case string. - Added #2263: _Crypt_GenRandom, fills a buffer with random data. - Changed #2117: _FileCountLines writing to a temporary array to calculate the number of lines in a file. - Changed: _FileListToArray to accept the Default keyword to use the default parameters. - Changed: _FileReadToArray to parse the file using a regular expression. Now various line endings (not recommended) are displayed correctly in the array. - Changed: Word UDF was completely re-written. Function names changed from _Word* to _Word_*. THIS IS A SCRIPT BREAKING CHANGE. - Changed: _Max and _Min functions now use the ternary operator. - Changed: Re-wrote _ReplaceStringInFile by removing the need to write to a temporary array. (@error values 4, 5 and 6 have been removed, please check the documentation.) - Changed: Re-wrote _GetIP for improved efficency and added http://www.myexternalip.com/raw to find the external IP address. - Changed: _SQLite 3.7.2.0 -> 3.7.16.2 - Changed: IE3.au3 v3.0-0 to v3.0-1 (see header info for changes) - Fixed #2077: hwnd safety check in _GUICtrlRichEdit_Create() - Fixed #2088: _ArrayDisplay not handling Default parameters correctly. - Fixed #2112: "Report Log Window" unresponsive when the script is closed. - Fixed: _GUICtrlRichEdit_* documentation error return codes. - Fixed #1970: _FTP_ListToArray() fails to retrieve Dir or File only. - Fixed #2084: Clipboard not being closed if an error occurred with _ClipBoard_SetDataEx. - Fixed #2125: Writing a 2-dimensional array would only write the first two columns of the array. - Fixed #2070: Unexpected crash on certain systems when using _GUICtrlStatusBar_GetText. - Fixed #2132: Documentation of _WinAPI_GetModuleHandle and the parameter to return the handle of the calling process. (Use the Null keyword, not 0.) - Fixed #2162: Documentation link in the IE Management section was broken for _IEFormElementCheckBoxSelect. - Fixed #2170: _ArrayDisplay fails handling arrays with no elements. - Fixed: _PathMake not appending backslash to the root path. - Fixed #2223: Incorrect UDF being referenced in _WordErrorHandlerRegister. - Fixed #2252: _GUICtrlListView_DeleteAllItems failed to remove items created using _GUICtrlListView_AddItem on an AutoIt native listview. - Fixed #1861: _ArrayDisplay incorrectly displayed an array when using the $sHeader parameter and the array contained the default separator. - Fixed: Using non-supported characters in the file prefix for _TempFile. - Fixed #2186: Documentation of _WinNet_AddConnection* and $sLocalName. (Use the Null keyword or an empty string, not 0.) - Fixed #2148: Crash when passing a number instead of a string. - Fixed #2219: _ExcelReadSheetToArray would cause AutoIt to hang when reading a protected worksheet. - Fixed #2242: Unable to write the 0th element in _FileWriteFromArray. Now the Default keyword is supported for the parameters $iBase and $iUBound, therefore use this instead of the value 0 for default parameters. (Please check the documentation.) - Fixed #2218: AutoIt crash when using _GUICtrlListView_SetGroupInfo before _GUICtrlListView_SetItemGroupID had been called. - Fixed #1996: _GUICtrlListView_SimpleSort failed to retain the ItemParam of an item. - Fixed #1759: Strange listview sort. - Fixed #2268: _StringReverse unable to reverse unicode characters. - Fixed #2298: Failing to detect when EnumDisplayDevices returns 0. - Fixed: _FileWriteFromArray failing to pass the $aArray parameter as a constant reference. - Fixed: $tagREBARBANDINFO not working on XP, due referencing parameters intended for Vista and above. - Fixed #2305: Reports the wrong width and height of the desktop when using default parameters. - Fixed #2335: _WinAPI_EnumWindows() and _WinAPI_EnumWindowsPopup() order - Fixed #2347: _WinAPI_GetMonitorInfo() wrong data. - Removed #2174: Explicitly checking if the source and insert strings for _StringInsert were strings and forcing an @error return value. (@error values 2 and 3 have been removed, please check the documentation.) - Removed #2187: Forcing _GUICtrlRichEdit_Create to create a richedit control in a positive position. (@error values 103 and 104 have been removed, please check the documentation.) - Removed #2172: Select...EndSelect statement and replaced with an If...EndIf as well as optimised the code. - Removed: Documentation and example for _Iif. Scripts should be updated to use ternary operators instead. - Removed: _ArrayCreate from Array.au3. Au3Check: - Added: Generating error for hex numbers longer than 16 characters. - Added: Compound assignment operators for object properties. - Added: Array access on expression - Added: Dot access on expression - Changed: Message case changed to support SciTE inline errors. - Changed: An error is now generated for non-supported file encodings (Previous behavior was to silently pass the script). - Changed: Au3Check version numbers now match AutoIt's. - Changed: Explicit size of arrays optional for explicit initialization. - Fixed #2113: Object's properties in names of keywords treated as keywords. - Fixed #2141: #IgnoreFunc was generating an incorrect error. Au3Record: - Fixed #2083: There is no longer an error about a missing DLL. - Fixed #2337: Support of non english keyboard. AutoIt3Help: - Changed: Manifest resource suggests Windows common controls v6.0. - Changed: Version number to 1.0.0.3. AutoItX: - Fixed: Crash in AU3_PixelSearch when function fails. Click here to download this file1 point -
1 point
-
New ternary operator - Discussion
czardas reacted to Blue_Drache for a topic
Says who? Not me. From what I can tell, Arabic script looks like a drunk chicken walked through the inkpot.1 point -
"If UBound($invarray) > 1 Then" will check the array to make sure it has more than 1 row.1 point
-
It's in the help file under "volatile" and has an experimental warning attached.1 point
-
Come'on guys, mine was only a gag / joke based on the "terrible terrible example", don't take it so seriusly and please continue with the constructive discourse. I can only learn from you because i can't teach nothing. Thanks1 point
-
#include <IE.au3> $sURL = "" $sTableId = "rounded-corner" _IEErrorHandlerRegister() $oIE = _IECreate($sURL) ; get reference to the table by id $oTable = _IEGetObjById($oIE, $sTableId) ; get a collection of all table rows $oTableRows = _IETagNameGetCollection($oTable, "TR") ; enumerate through the collection For $oTableRow In $oTableRows ; get the value of the onclick attribute $sOnClickValue = $oTableRow.getAttribute("onclick") ConsoleWrite($sOnClickValue & @CRLF) Next1 point
-
Debug RegRead by checking what @error and @extended return.1 point
-
This works properly (red retangle) on my system (Win7 x64 + Aero): #include <WinApi.au3> #include <Misc.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> _Singleton(@ScriptFullPath) Global $iCtrlOrder = 1, $iLayers, $sLayersNN, $hTopControl, $iUpVal = 0, $iTTx, $iTTy Local $aMouse, $tPoint, $hWnd, $hNextWin, $windowList, $hControl, $iPosX, $iPosY, $hOldTopControl = 0, $x, $y Local $aPos, $sClassNN, $sClass, $iCount, $iId, $sCtrl, $aPos, $aWinList, $aUniqList, $iInstances, $iStart Local $aClassNNList, $tRect, $sWin, $ExitBut, $WinClass, $WinAtPtFlag Local Const $frame_size = 3 Local $hGUI_Mark = GUICreate("", 0, 0, 0, 0, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW), $x1, $x2, $y1, $y2, $x1o, $y1o GUISetBkColor(0xFF0000, $hGUI_Mark) GUISetState() HotKeySet("!h", "_Help") HotKeySet("!s", "_CtrlOrder") HotKeySet("!q", "_Exit") HotKeySet("!{UP}", "_UpLayers") HotKeySet("!{DOWN}", "_UpLayers") While 1 $tPoint = _WinAPI_GetMousePos() $x = DllStructGetData($tPoint, "x") $y = DllStructGetData($tPoint, "y") If ($x <> $iTTx Or $y <> $iTTy) Then $WinAtPtFlag = 0 $iUpVal = 0 $hWnd = _WinAPI_GetAncestor(_WinAPI_WindowFromPoint($tPoint), 2); 2 = $GA_ROOT $WinClass = _WinAPI_GetClassName($hWnd) $hNextWin = "" $hTopControl = "" ; -------- ClassNN List ------------------------------ $windowList = WinGetClassList($hWnd) ;ConsoleWrite($windowList & @LF) $aWinList = StringRegExp($windowList, "[^\v]+", 3) $aUniqList = _ArrayUnique($aWinList) ;_ArrayDisplay($aUniqList) If IsArray($aUniqList) Then For $j = 1 To $aUniqList[0] StringRegExpReplace($windowList, "(?sm)^(" & $aUniqList[$j] & ")$", "") ; The number of replacements performed is stored in @extended. $iInstances = @extended ;ConsoleWrite($aUniqList[$j] & " " & $iInstances & @LF) For $k = $iInstances To 1 Step -1 $iStart = StringInStr($windowList, $aUniqList[$j] & @LF, 2, $k) $windowList = StringRegExpReplace($windowList, "(?sm)^(.{" & $iStart - 1 & "}^" & $aUniqList[$j] & ")$", "${1}" & $k) Next Next ;ConsoleWrite($windowList & @LF & "-----------" & @LF) $aClassNNList = StringRegExp($windowList, "[^\v]+", 3) ; --------> End of ClassNN List ------------------------------ ; --------- Get all layers under Mouse ---------------- $iLayers = 0 $sLayersNN = "" For $j = 0 To UBound($aClassNNList) - 1 $hControl = ControlGetHandle($hWnd, "", $aClassNNList[$j]) ;ConsoleWrite($aClassNNList[$j] & " " & $hControl & @LF) $tRect = _WinAPI_GetWindowRect($hControl) If ControlCommand($hWnd, "", $aClassNNList[$j], "IsVisible") And _ ; Check if control is visible under mouse DllStructGetData($tRect, "Left") <= $x And DllStructGetData($tRect, "Right") >= $x And _ ; Check if control is under mouse DllStructGetData($tRect, "Top") <= $y And DllStructGetData($tRect, "Bottom") >= $y Then $sLayersNN &= @TAB & @TAB & @TAB & $aClassNNList[$j] & @TAB & $hControl & @TAB & @LF ; Add ClassnameNN & Ctrl handle to string. $iLayers += 1 ; Number of controls (layers) If $iCtrlOrder = 0 And $iLayers = 1 Then ; After Alt+s keys has been pressed, the top most control is the first control encountered. $hTopControl = $hControl $sClassNN = $aClassNNList[$j] ElseIf $iCtrlOrder <> 0 Then ; Before Alt+s keys is pressed, the top most control is the last control encountered in the For-Next loop. $hTopControl = $hControl $sClassNN = $aClassNNList[$j] EndIf #cs ; _WinAPI_GetWindow() was found not to be useful in this application. ConsoleWrite($aClassNNList[$j] & " HWNDFIRST: " & _WinAPI_GetWindow($hControl & $iCount, 0) & _ " HWNDLAST: " & _WinAPI_GetWindow($hControl & $iCount, 1) & _ " HWNDNEXT: " & _WinAPI_GetWindow($hControl & $iCount, 2) & _ " HWNDPREV: " & _WinAPI_GetWindow($hControl & $iCount, 3) & _ " OWNER: " & _WinAPI_GetWindow($hControl & $iCount, 4) & _ " CHILD: " & _WinAPI_GetWindow($hControl & $iCount, 5) & @LF) #ce ;ConsoleWrite("From Pt " & _WinAPI_WindowFromPoint($tPoint)& @LF) EndIf Next ;ConsoleWrite("-------------------" & @LF) ; -----> End of "Get all layers under Mouse" ---------------- EndIf ; ------------- Gather all info for Tooltip -------------- $sWin = ">>>>Window<<<< Press Alt+h for Help" & @LF & _ "Title:" & @TAB & WinGetTitle("[Handle:" & $hWnd & "]", "") & @LF & _ "Class:" & @TAB & $WinClass & @LF & _ "Handle:" & @TAB & $hWnd & @LF & @LF & _ ">>>>Mouse<<<< " & @LF & _ "Absolute Position: " & DllStructGetData($tPoint, "x") & ", " & DllStructGetData($tPoint, "y") & @LF _WinAPI_ScreenToClient($hTopControl, $tPoint) If $hTopControl = "" Then ; Window only - no controls under mouse. $sCtrl = "" $tRect = _WinAPI_GetWindowRect($hWnd) Else $tRect = _WinAPI_GetWindowRect($hTopControl) $iId = _WinAPI_GetDlgCtrlID($hTopControl) If $iId = 0 Then $iId = "" $aPos = ControlGetPos($hWnd, "", $sClassNN) $sCtrl = @LF & _ ">>>>Control<<<< " & @LF & _ "ClassNameNN:" & @TAB & $sClassNN & @LF & _ "ID:" & @TAB & @TAB & $iId & @LF & _ "Handle:" & @TAB & @TAB & $hTopControl & @LF & _ "Position:" & @TAB & @TAB & $aPos[0] & ", " & $aPos[1] & "; Abs:" & DllStructGetData($tRect, "Left") & ", " & DllStructGetData($tRect, "Top") & @LF & _ "Size:" & @TAB & @TAB & $aPos[2] & ", " & $aPos[3] & @LF & _ "ControlClick Coords: " & DllStructGetData($tPoint, "x") & ", " & DllStructGetData($tPoint, "y") & @LF & _ "No. of Ctrl Layers under Mouse: " & @TAB & $iLayers & @LF If $iLayers > 1 Then $sCtrl &= "Ctrl Layers ClassNN/Hnd:- " & @LF & $sLayersNN EndIf ; ----- Tooltip ---- $aPos = MouseGetPos() $iPosX = ($aPos[0] - 400) * ($aPos[0] > @DesktopWidth - 400) + ($aPos[0] <= @DesktopWidth - 400) * ($aPos[0] + 20) $iPosY = ($aPos[1] - 400) * ($aPos[1] > @DesktopHeight - 400) + ($aPos[1] <= @DesktopHeight - 400) * ($aPos[1] + 20) ; ---> Eng of Tooltip ---- $iTTx = $x ; For "If ($x <> $iTTx Or $y <> $iTTy) Then" line @ top of While loop - Steadies tooltip display. $iTTy = $y If $hOldTopControl <> $hTopControl Then ; - Steadies red outline display. _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) ; Clears Red outline graphics. $hOldTopControl = $hTopControl EndIf ;~ _DrawtRect($tRect) $x1 = DllStructGetData($tRect, "Left") $y1 = DllStructGetData($tRect, "Top") $x2 = DllStructGetData($tRect, "Right") $y2 = DllStructGetData($tRect, "Bottom") If $x1 <> $x1o Or $y1 <> $y1o Then ToolTip($sWin & $sCtrl, $iPosX, $iPosY) WinMove($hGUI_Mark, "", $x1, $y1, $x2 - $x1, $y2 - $y1) _GuiHole($hGUI_Mark, $frame_size, $frame_size, ($x2 - $x1) - 2 * $frame_size, ($y2 - $y1) - 2 * $frame_size, ($x2 - $x1), ($y2 - $y1)) GUISetState(@SW_SHOW, $hGUI_Mark) WinSetOnTop($hGUI_Mark, 0, 1) $x1o = $x1 $y1o = $y1 EndIf EndIf Sleep(30) WEnd Func _GuiHole($hWnd, $i_x, $i_y, $i_sizew, $i_sizeh, $width, $height) Local $outer_rgn, $inner_rgn, $combined_rgn $outer_rgn = _WinAPI_CreateRectRgn(0, 0, $width, $height) $inner_rgn = _WinAPI_CreateRectRgn($i_x, $i_y, $i_x + $i_sizew, $i_y + $i_sizeh) $combined_rgn = _WinAPI_CreateRectRgn(0, 0, 0, 0) _WinAPI_CombineRgn($combined_rgn, $outer_rgn, $inner_rgn, $RGN_DIFF) _WinAPI_DeleteObject($outer_rgn) _WinAPI_DeleteObject($inner_rgn) _WinAPI_SetWindowRgn($hWnd, $combined_rgn) EndFunc ;==>_GuiHole Func _Help() Local $myedit, $msg, $Text ToolTip("") $Text = @LF & @TAB & @TAB & @TAB & _ " Hot Keys" & @LF & @LF & _ " Press Alt + s keys toggles reversing the detection order of the" & @LF & _ " layered controls. (If a control that the mouse" & @LF & _ " is hovering is not being selected but the control " & @LF & _ " at the bottom of the layers is selected, pressing the" & @LF & _ " Alt+s keys may enable that top control to be selected.);" & @LF & @LF & _ ' Press Alt + UP keys when the Alt + s keys are in the "have not been pressed' & @LF & _ ' state". Each Alt+UP keys press selects in green the' & @LF & _ " next below layered control. At the bottom of the" & @LF & _ ' tooltip each "Ctrl Layer" progressively climbs up' & @LF & _ " from the bottom of the red highlited control in the list." & @LF & @LF & _ ' Press Alt + DOWN keys when the Alt + s keys are in the "have been pressed' & @LF & _ ' state". Each Alt+Down keys press selects in green, for' & @LF & _ " 2 secs, the next below layered control. At the bottom of" & @LF & _ ' the tooltip each "Ctrl Layer" progressively decended away' & @LF & _ " from the top red highlited control in the list." & @LF & @LF & _ " Note: While scrolling up and down through the layers, the mouse must not move." & @LF & @LF & _ " Press Alt + q keys to quit;" & @LF & @LF & _ " Press Alt + h keys for this help window." GUICreate("Help Window", 450, 450) ; will create a dialog box that when displayed is centered GUISetFont(9) $myedit = GUICtrlCreateLabel($Text, 2, 0) $ExitBut = GUICtrlCreateButton('Continue', 190, 410, 70, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Or $msg = $ExitBut Then ExitLoop WEnd GUIDelete() EndFunc ;==>_Help Func _UpLayers() Local $aLay, $iIndex, $tRect, $tRectGrn, $iUbIndx ;ConsoleWrite(@HotKeyPressed & @LF) $iUpVal += 1 $aLay = StringRegExp($sLayersNN, "\h(0x[^\s]+)", 3) If IsArray($aLay) Then $iUbIndx = UBound($aLay) - 1 $iIndex = _ArraySearch($aLay, $hTopControl) ;if $iIndex < $iUbIndx then $iIndex += $iUpVal Switch @HotKeyPressed Case "!{UP}" If $iIndex - $iUpVal >= 0 Then $iIndex -= $iUpVal Else $iIndex = 0 EndIf Case "!{DOWN}" If $iIndex + $iUpVal <= $iUbIndx Then $iIndex += $iUpVal Else $iIndex = $iUbIndx EndIf EndSwitch $tRect = _WinAPI_GetWindowRect($hTopControl) $tRectGrn = _WinAPI_GetWindowRect($aLay[$iIndex]) ;ConsoleWrite($iUpVal & " " & $aLay[$iIndex] & @LF) _DrawtRect($tRect) _DrawtRect($tRectGrn, 0x00ff00) While Sleep(2000) = 0 WEnd _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) EndIf EndFunc ;==>_UpLayers Func _CtrlOrder() If $iCtrlOrder = 1 Then ; Alt+S has not been pressed. $iCtrlOrder = 0 ; Means Alt+S has been pressed. Else $iCtrlOrder = 1 ; Alt+S is in not been pressed state. EndIf EndFunc ;==>_CtrlOrder ; Draws coloured rectangle on screen. Func _DrawtRect($tRect, $color = 0xFF, $PenWidth = 2) Local $hDC, $hPen, $obj_orig, $x1, $x2, $y1, $y2 $x1 = DllStructGetData($tRect, "Left") $x2 = DllStructGetData($tRect, "Right") $y1 = DllStructGetData($tRect, "Top") $y2 = DllStructGetData($tRect, "Bottom") $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop) $hPen = _WinAPI_CreatePen($PS_SOLID, $PenWidth, $color) $obj_orig = _WinAPI_SelectObject($hDC, $hPen) _WinAPI_DrawLine($hDC, $x1, $y1, $x2, $y1) ; horizontal to right _WinAPI_DrawLine($hDC, $x2, $y1, $x2, $y2) ; vertical down on right _WinAPI_DrawLine($hDC, $x2, $y2, $x1, $y2) ; horizontal to left right _WinAPI_DrawLine($hDC, $x1, $y2, $x1, $y1) ; vertical up on left ; clear resources _WinAPI_SelectObject($hDC, $obj_orig) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) EndFunc ;==>_DrawtRect Func _Exit() _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) Exit EndFunc ;==>_Exit Btw, do you know how I can check whether a frame has a scrollbar? E.g. if you open the help file you will see on the right frame a scrollbar.... Br, UEZ1 point
-
This forum and the help file was it for me. I've honestly only asked a couple of questions (and in both cases the answer was in the help file) and try to mainly answer them on here. The reason I point that out is because if you search correctly and hard enough, you can literally find example code of how to do pretty much anything on here (or at least point you in the right direction) My best advice, find a project that you would like to build, some kind of application. Automate some task that you have to perform manually every day and use the search feature to find examples of what you want to do. Here are some ideas for small scripts that teach you important concepts about the language. By the time you finish all of these, you should be the one answering the questions: http://www.dreamincode.net/forums/topic/78802-martyr2s-mega-project-ideas-list/ PM me if you would like a solution to any of them and I'd be happy to provide it for you.1 point
-
ByRef in Call: This does not work with CallArgArray, elements will not be changed. For the new functions as first class objects, here is an example of possible usage, that might actually be useful. _EnumFolder("C:\", MyCallback) Func MyCallback($sFile) ConsoleWrite($sFile & @LF) EndFunc ;==>MyCallback Func _EnumFolder($sPath, $Callback) If StringRight($sPath, 1) <> '\' Then $sPath &= '\' Local $hFind = FileFindFirstFile($sPath & "*.*") If $hFind < 0 Then Return SetError(1) Local $sFile While 1 $sFile = FileFindNextFile($hFind) If @error Then ExitLoop $Callback($sFile) WEnd FileClose($hFind) EndFunc ;==>_EnumFolder This does not create an empty array: Local $a = [] ConsoleWrite(UBound($a) & @LF) This does: Local $a[0] ConsoleWrite(UBound($a) & @LF) Currently _ArrayAdd works with empty arrays, but _ArrayDelete probably needs to be modified to allow returning of empty arrays rather than a string. And finally: Whatever you do, do not use the new conditional operator like the changelog does to return True or False.1 point
-
Hmm, it hadn't been typed into the changelog, but there were some significant changes to Aut2Exe/compiling as well. Scripts are stored as a normal resource rather than hacked onto the end of the exe. Look in the helpfile for directives/#pragma options which allow you to control aspects of the compiled exe like icons/versions/UAC options. Most of this was available in the scite editor/autoitwrapper scripts but it's nice to have it self contained in the main compiler.1 point
-
I got the solution. The problem for i am getting the error message is we have upgraded our SQL server to 2008 version.The Function _SQL_Connect() is not suppporting SQL2008. so we need to modify the function slightly. Please find the modified function below and try with this if anyone face the similar issue. Func _SQL_Connect($ADODBHandle, $server, $db, $username, $password, $SQLAuth = True) $SQLErr = "" If $ADODBHandle = -1 Then $ADODBHandle = $SQL_LastConnection If Not IsObj($ADODBHandle) Then $SQLErr = "Invalid ADODB.Connection object, use _SQL_Startup()" Return SetError($SQL_ERROR, 0, $SQL_ERROR) EndIf If $SQLAuth = True then $ADODBHandle.Open("DRIVER={SQL Server Native Client 10.0};SERVER=" & $server & ";DATABASE=" & $db & ";uid=" & $username & ";pwd=" & $password & ";") ;<==This line has been modified from [$ADODBHandle.Open("DRIVER={SQL Server};SERVER=" & $server & ";DATABASE=" & $db & ";uid=" & $username & ";pwd=" & $password & ";")] Else $ADODBHandle.Properties("Integrated Security").Value = "SSPI" $ADODBHandle.Properties("User ID") = $username $ADODBHandle.Properties("Password") = $password $ADODBHandle.Open("DRIVER={SQL Server};SERVER=" & $server & ";DATABASE=" & $db ) EndIf If Not @error Then Return SetError($SQL_OK, 0, $SQL_OK) Else $SQLErr = "Connection Error" Return SetError($SQL_ERROR, 0, $SQL_ERROR) EndIf EndFunc ;==>_SQL_Connect Note: Now all set free for me and works great!1 point