Leaderboard
Popular Content
Showing content with the highest reputation on 04/04/2018 in all areas
-
Get text and background colour from standard controls How to retrieve the data you already have... Not a very useful thing, as it only works for in-process standard controls, but there you go. This example is based on code by Prog@ndy and Malkey in this thread: GUICtrlGetColor() ?do=embed' frameborder='0' data-embedContent> Standard Controls do not store colour in their Device Context. (CS_OWNDC) Using GetTextColor() on the controls DC returns 0xFFFFFF, (COLOR_WINDOW) the default value in the WNDCLASS structure. The parent window sets the colour (CS_PARENTDC) By sending a WM_CTLCOLORSTATIC message to the controls parent window. we can have it write to a temporary memory DC and then use GetTextColor/GetBkColor. The four functions return the RGB colours of visible, hidden or disabled Standard Controls on active, inactive, hidden, disabled, locked or minimized AutoIt GUI forms. The following form/control classes have been tested in XP/VISTA x86: AutoIt v3 GUI, Static (Label), Edit(Edit/Input), Button (Ownerdrawn/Classic Theme PushButton**, Group, Radio, CheckBox), ListBox, ComboBox _GuiCtrlGetTextColorEx() - get RGB text colour of visible/hidden/disabled in-process* controls. on an active, inactive, hidden, locked, disabled or minimized gui. _GuiCtrlGetBkColorEx() - get RGB background colour of visible/hidden/disabled in-process* controls. on an active, inactive, hidden, locked, disabled or minimized gui. _GUIGetBkColorEx() - get RGB background colour of active, inactive, hidden, locked, disabled or minimized in-process* forms. - the only feature this adds over existing forum examples is getting colour from a minimized gui _GuiCtrlGetColorEx() - all-in-one testing version with ownerdrawn/themed button testing Use the separate functions _GUICtrlGetTextColorEx() and_GUICtrlGetBkColorEx() instead of this *This UDF only supports controls in the current script process. It does not work with external process controls. Nor does it support controls that are painted on (colour not set by WM_CTLCOLORSTATIC message) themed controls or Common Controls (they have their own methods to retrieve colour) Does not return transparent layered window attributes, use _WinAPI_GetLayeredWindowAttributes() Disabled and/or hidden controls will still return their enabled colours, the WM_CTLCOLORSTATIC message does not return the system colours for disabled controls. **NOTE: ownerdrawn buttons with no set background color default to the COLOR_BTNFACE system colour, but the returned background mode is OPAQUE and the colour is the underlying colour of the parent gui, so GetPixel() is required to get the actual colour. There will probably be some conditions or OS versions where this code will return incorrect or no colour. Other get control colour examples: Get GUI Background color? is there such a thing?? GUICtrlGetColor() ?do=embed' frameborder='0' data-embedContent> GUICtrlGetBkColor() - Get the background color of a control Get colour get label colour Example: Get text, background colour and background mode from four standard controls (visible/hidden/disabled) while looping through the following gui states: active, inactive, hidden, minimized, locked and disabled. ;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include "_GetCtrlColorEx.au3" #include <GUIConstantsEx.au3> #include <Constants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> Opt('MustDeclareVars', 1) Global $aColour, $aStr[4] = ["Edit", "Static 1", "Static 2", "Button "] Global $hGui = GUICreate('Get Control Colours', 230, 200) GUISetBkColor(0xABCDEF) Global $cFst = GUICtrlCreateInput('Edit', 20, 10, 160, 20);, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xFAFAFF) GUICtrlCreateLabel("Static 1", 20, 45, 160, 20, BitOR($SS_CENTERIMAGE, $SS_CENTER)) GUICtrlSetColor(-1, 0x191970) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlCreateLabel("Static 2", 20, 80, 160, 20) GUICtrlSetColor(-1, 0xFFE9A9) GUICtrlSetBkColor(-1, 0x6E7B80) GUICtrlCreateButton("Button", 20, 115, 160, 25) ;Ownerdrawn GUICtrlSetColor(-1, 0xFAFAFF) GUICtrlSetBkColor(-1, 0x494949) ;classic theme ;DllCall("uxtheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", "", "wstr", "") GUISetState() For $i = 0 To 6 Switch $i Case 0 ConsoleWrite("+ ACTIVE ====================" & @CRLF) Case 1 Sleep(1000) ConsoleWrite("+ INACTIVE ==================" & @CRLF) _WinAPI_SetWindowPos($hGui, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE)) Case 2 Sleep(1000) _WinAPI_SetWindowPos($hGui, $HWND_TOP, 0, 0, 0, 0, BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE)) Sleep(1000) ConsoleWrite("+ HIDDEN ====================" & @CRLF) GUISetState(@SW_HIDE) Case 3 Sleep(1000) GUISetState(@SW_SHOW) Sleep(1000) ConsoleWrite("+ MINIMIZED ==================" & @CRLF) GUISetState(@SW_MINIMIZE) Case 4 Sleep(1000) GUISetState(@SW_RESTORE) ConsoleWrite("+ LOCKED ======================" & @CRLF) GUISetState(@SW_LOCK) Case 5 Sleep(1000) GUISetState(@SW_UNLOCK) ConsoleWrite("+ DISABLED ====================" & @CRLF) GUISetState(@SW_DISABLE) Sleep(1000) Case 6 GUISetState(@SW_ENABLE) ConsoleWrite("+ CONTROLS HIDDEN/DISABLED =====" & @CRLF) For $j = $cFst To ($cFst+3) GUICtrlSetState($j, $GUI_DISABLE) GUICtrlSetState($j, $GUI_HIDE) Next Sleep(1000) EndSwitch For $k = $cFst To ($cFst+3) $aColour = _GUICtrlGetColorEx($k, 1) ConsoleWrite("+ "&$aStr[$k-$cFst]&" Text Colour: " & $aColour[0][0] & @CRLF) ConsoleWrite("+ "&$aStr[$k-$cFst]&" Text Colour: " & _GUICtrlGetTextColorEx($k, 1) & @CRLF) ConsoleWrite("- "&$aStr[$k-$cFst]&" BkGnd Colour: " & $aColour[1][0] & " - " & $aColour[1][1] & @CRLF) ConsoleWrite("- "&$aStr[$k-$cFst]&" BkGnd Colour: " & _GUICtrlGetBkColorEx($k, 1) & " - Mode: " & @extended & @CRLF & @CRLF) Next ConsoleWrite("> GUI BkGnd Colour: " & _GUIGetBkColorEx($hGui, 1) & @CRLF & @CRLF) Next For $j = $cFst To ($cFst+3) GUICtrlSetState($j, $GUI_ENABLE) GUICtrlSetState($j, $GUI_SHOW) Next Do Until GUIGetMsg() = -3 Exit_GetCtrlColorEx.au31 point
-
Hello, try this Run("route -p change 0.0.0.0 mask 0.0.0.0 192.168.1.2", @SystemDir, @SW_HIDE) -p is called permanently1 point
-
You can try with this : #RequireAdmin #Include "network.au3" _SetGateways("Broadcom NetLink (TM) Gigabit Ethernet", "192.168.1.1") ; Replace "Broadcom...." by the name of the network adapter name (or connection name)1 point
-
According to the SciTE output you are running AutoIt 3.3.14.3. Upgrade to 3.3.14.5. I was able to run the test.au3 and example.au3 without issue. AdamUL1 point
-
Draygoes, Either post in the UDF thread or provide a link - why should we all have to search for the UDF thread? M231 point
-
Autocomplete functionality
Earthshine reacted to Juvigy for a topic
Thank you Melba23. I tried to search but couldn't find it. Earthshine, Who said that $MS doesn't have a sense of humor?1 point -
How to get the error Handling of Autoit commands integrated with Robot Framework?
Earthshine reacted to Danp2 for a topic
You'll need to help us help you by providing additional details, such as -- What is RIDE / Robot Framework? Provide link(s) to these resources. Show your Autoit code. Show an example of how you are calling this code from the testing framework1 point -
Search the forum for HotString.au31 point
-
For $i = 0 to $URL_max - 1 Should be: For $i = 1 to $URL_max1 point