Leaderboard
Popular Content
Showing content with the highest reputation on 12/30/2019 in all areas
-
You could also increase readability of the button creation like this : Local $av_btn_Production[30], $av_btn_Shadow[30], $av_btn_QA[30], $iInd $iInd = 0 For $y = 0 To 9 For $x = 0 To 2 $av_btn_Production[$iInd] = GUICtrlCreateButton("Production_" & StringFormat("%02i", $iInd + 1), 10 + 270 * $x, 70 + 50 * $y, 270, 50) GUICtrlSetState(-1, $GUI_HIDE) $iInd += 1 Next Next $iInd = 0 For $y = 0 To 9 For $x = 0 To 2 $av_btn_Shadow[$iInd] = GUICtrlCreateButton("Shadow_" & StringFormat("%02i", $iInd + 1), 10 + 270 * $x, 70 + 50 * $y, 270, 50) GUICtrlSetState(-1, $GUI_HIDE) $iInd += 1 Next Next $iInd = 0 For $y = 0 To 9 For $x = 0 To 2 $av_btn_QA[$iInd] = GUICtrlCreateButton("QA_" & StringFormat("%02i", $iInd + 1), 10 + 270 * $x, 70 + 50 * $y, 270, 50) GUICtrlSetState(-1, $GUI_HIDE) $iInd += 1 Next Next2 points
-
Why not just use GuiCtrlSetData? Example #include <Constants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <ComboConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> If _Singleton("JETS", 1) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "JETS is already running!") Exit EndIf Global $y = 70, $aButtons[30][2] $hGUI = GUICreate("JETS", 829, 600, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_MINIMIZEBOX) $Combo_01 = GUICtrlCreateCombo("", 160, 20, 145, 21, -1) GUICtrlSetData($Combo_01, "|Production|Shadow|QA", "") $Label_01 = GUICtrlCreateLabel("Select Your Environment:", 20, 25, 140, 30, -1) For $i = 0 To UBound($aButtons) - 1 Step 3 $aButtons[$i][1] = $i + 1 $aButtons[$i][0] = GUICtrlCreateButton($aButtons[$i][1], 10, $y, 270, 50) $aButtons[$i + 1][1] = $i + 2 $aButtons[$i + 1][0] = GUICtrlCreateButton($aButtons[$i + 1][1], 280, $y, 270, 50) $aButtons[$i + 2][1] = $i + 3 $aButtons[$i + 2][0] = GUICtrlCreateButton($aButtons[$i + 2][1], 550, $y, 270, 50) $y += 50 Next GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Combo_01 For $i = 0 To UBound($aButtons) - 1 If GUICtrlRead($Combo_01) = "" Then GUICtrlSetData($aButtons[$i][0], $i + 1) Else GUICtrlSetData($aButtons[$i][0], GUICtrlRead($Combo_01) & "_" & $i + 1) EndIf Next Case $aButtons[0][0] To $aButtons[UBound($aButtons) - 1][0] Switch GUICtrlRead($Combo_01) Case "Production" MsgBox(4096, "Production Button Clicked", "Production_" & $aButtons[$msg - $aButtons[0][0]][1] & " clicked.") Case "Shadow" MsgBox(4096, "Shadow Button Clicked", "Shadow_" & $aButtons[$msg - $aButtons[0][0]][1] & " clicked.") Case "QA" MsgBox(4096, "QA Button Clicked", "QA_" & $aButtons[$msg - $aButtons[0][0]][1] & " clicked.") Case Else ;~ No Combo item selected ContinueLoop EndSwitch EndSwitch WEnd2 points
-
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
-
Hi @FrancescoDiMuro : I would add a check to see if $Environment has changed. Otherwise the message boxes are permanently redrawn, which causes flickering. #Region ---Head-- #include <Constants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <ComboConstants.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> ; Declaring three Global arrays of 30 elements Global $arrProductionButtons[30] Global $arrShadowButtons[30] Global $arrQAButtons[30] Global $Environment = "Production" Global $EnvironmentSelected = "Production" Global $bEnvironmentShow = False If _Singleton("JETS", 1) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "JETS is already running!") Exit EndIf $hGUI = GUICreate("JETS", 829, 600, -1, -1, $WS_OVERLAPPED + $WS_CAPTION + $WS_SYSMENU + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_MINIMIZEBOX) $Combo_01 = GUICtrlCreateCombo("", 160, 20, 145, 21, -1) GUICtrlSetData($Combo_01, "Production|Shadow|QA", "") $Label_01 = GUICtrlCreateLabel("Select Your Environment:", 20, 25, 140, 30, -1) ; Assigning each control to an element? $arrProductionButtons[0] = GUICtrlCreateButton("Production_01", 10, 70, 270, 50, -1) $arrProductionButtons[1] = GUICtrlCreateButton("Production_02", 280, 70, 270, 50, -1) $arrProductionButtons[2] = GUICtrlCreateButton("Production_03", 550, 70, 270, 50, -1) $arrProductionButtons[3] = GUICtrlCreateButton("Production_04", 10, 120, 270, 50, -1) $arrProductionButtons[4] = GUICtrlCreateButton("Production_05", 280, 120, 270, 50, -1) $arrProductionButtons[5] = GUICtrlCreateButton("Production_06", 550, 120, 270, 50, -1) $arrProductionButtons[6] = GUICtrlCreateButton("Production_07", 10, 170, 270, 50, -1) $arrProductionButtons[7] = GUICtrlCreateButton("Production_08", 280, 170, 270, 50, -1) $arrProductionButtons[8] = GUICtrlCreateButton("Production_09", 550, 170, 270, 50, -1) $arrProductionButtons[9] = GUICtrlCreateButton("Production_10", 10, 220, 270, 50, -1) $arrProductionButtons[10] = GUICtrlCreateButton("Production_11", 280, 220, 270, 50, -1) $arrProductionButtons[11] = GUICtrlCreateButton("Production_12", 550, 220, 270, 50, -1) $arrProductionButtons[12] = GUICtrlCreateButton("Production_13", 10, 270, 270, 50, -1) $arrProductionButtons[13] = GUICtrlCreateButton("Production_14", 280, 270, 270, 50, -1) $arrProductionButtons[14] = GUICtrlCreateButton("Production_15", 550, 270, 270, 50, -1) $arrProductionButtons[15] = GUICtrlCreateButton("Production_16", 10, 320, 270, 50, -1) $arrProductionButtons[16] = GUICtrlCreateButton("Production_17", 280, 320, 270, 50, -1) $arrProductionButtons[17] = GUICtrlCreateButton("Production_18", 550, 320, 270, 50, -1) $arrProductionButtons[18] = GUICtrlCreateButton("Production_19", 10, 370, 270, 50, -1) $arrProductionButtons[19] = GUICtrlCreateButton("Production_20", 280, 370, 270, 50, -1) $arrProductionButtons[20] = GUICtrlCreateButton("Production_21", 550, 370, 270, 50, -1) $arrProductionButtons[21] = GUICtrlCreateButton("Production_22", 10, 420, 270, 50, -1) $arrProductionButtons[22] = GUICtrlCreateButton("Production_23", 280, 420, 270, 50, -1) $arrProductionButtons[23] = GUICtrlCreateButton("Production_24", 550, 420, 270, 50, -1) $arrProductionButtons[24] = GUICtrlCreateButton("Production_25", 10, 470, 270, 50, -1) $arrProductionButtons[25] = GUICtrlCreateButton("Production_26", 280, 470, 270, 50, -1) $arrProductionButtons[26] = GUICtrlCreateButton("Production_27", 550, 470, 270, 50, -1) $arrProductionButtons[27] = GUICtrlCreateButton("Production_28", 10, 520, 270, 50, -1) $arrProductionButtons[28] = GUICtrlCreateButton("Production_29", 280, 520, 270, 50, -1) $arrProductionButtons[29] = GUICtrlCreateButton("Production_30", 550, 520, 270, 50, -1) $arrShadowButtons[0] = GUICtrlCreateButton("Shadow_01", 10, 70, 270, 50, -1) $arrShadowButtons[1] = GUICtrlCreateButton("Shadow_02", 280, 70, 270, 50, -1) $arrShadowButtons[2] = GUICtrlCreateButton("Shadow_03", 550, 70, 270, 50, -1) $arrShadowButtons[3] = GUICtrlCreateButton("Shadow_04", 10, 120, 270, 50, -1) $arrShadowButtons[4] = GUICtrlCreateButton("Shadow_05", 280, 120, 270, 50, -1) $arrShadowButtons[5] = GUICtrlCreateButton("Shadow_06", 550, 120, 270, 50, -1) $arrShadowButtons[6] = GUICtrlCreateButton("Shadow_07", 10, 170, 270, 50, -1) $arrShadowButtons[7] = GUICtrlCreateButton("Shadow_08", 280, 170, 270, 50, -1) $arrShadowButtons[8] = GUICtrlCreateButton("Shadow_09", 550, 170, 270, 50, -1) $arrShadowButtons[9] = GUICtrlCreateButton("Shadow_10", 10, 220, 270, 50, -1) $arrShadowButtons[10] = GUICtrlCreateButton("Shadow_11", 280, 220, 270, 50, -1) $arrShadowButtons[11] = GUICtrlCreateButton("Shadow_12", 550, 220, 270, 50, -1) $arrShadowButtons[12] = GUICtrlCreateButton("Shadow_13", 10, 270, 270, 50, -1) $arrShadowButtons[13] = GUICtrlCreateButton("Shadow_14", 280, 270, 270, 50, -1) $arrShadowButtons[14] = GUICtrlCreateButton("Shadow_15", 550, 270, 270, 50, -1) $arrShadowButtons[15] = GUICtrlCreateButton("Shadow_16", 10, 320, 270, 50, -1) $arrShadowButtons[16] = GUICtrlCreateButton("Shadow_17", 280, 320, 270, 50, -1) $arrShadowButtons[17] = GUICtrlCreateButton("Shadow_18", 550, 320, 270, 50, -1) $arrShadowButtons[18] = GUICtrlCreateButton("Shadow_19", 10, 370, 270, 50, -1) $arrShadowButtons[19] = GUICtrlCreateButton("Shadow_20", 280, 370, 270, 50, -1) $arrShadowButtons[20] = GUICtrlCreateButton("Shadow_21", 550, 370, 270, 50, -1) $arrShadowButtons[21] = GUICtrlCreateButton("Shadow_22", 10, 420, 270, 50, -1) $arrShadowButtons[22] = GUICtrlCreateButton("Shadow_23", 280, 420, 270, 50, -1) $arrShadowButtons[23] = GUICtrlCreateButton("Shadow_24", 550, 420, 270, 50, -1) $arrShadowButtons[24] = GUICtrlCreateButton("Shadow_25", 10, 470, 270, 50, -1) $arrShadowButtons[25] = GUICtrlCreateButton("Shadow_26", 280, 470, 270, 50, -1) $arrShadowButtons[26] = GUICtrlCreateButton("Shadow_27", 550, 470, 270, 50, -1) $arrShadowButtons[27] = GUICtrlCreateButton("Shadow_28", 10, 520, 270, 50, -1) $arrShadowButtons[28] = GUICtrlCreateButton("Shadow_29", 280, 520, 270, 50, -1) $arrShadowButtons[29] = GUICtrlCreateButton("Shadow_00", 550, 520, 270, 50, -1) $arrQAButtons[0] = GUICtrlCreateButton("QA_01", 10, 70, 270, 50, -1) $arrQAButtons[1] = GUICtrlCreateButton("QA_02", 280, 70, 270, 50, -1) $arrQAButtons[2] = GUICtrlCreateButton("QA_03", 550, 70, 270, 50, -1) $arrQAButtons[3] = GUICtrlCreateButton("QA_04", 10, 120, 270, 50, -1) $arrQAButtons[4] = GUICtrlCreateButton("QA_05", 280, 120, 270, 50, -1) $arrQAButtons[5] = GUICtrlCreateButton("QA_06", 550, 120, 270, 50, -1) $arrQAButtons[6] = GUICtrlCreateButton("QA_07", 10, 170, 270, 50, -1) $arrQAButtons[7] = GUICtrlCreateButton("QA_08", 280, 170, 270, 50, -1) $arrQAButtons[8] = GUICtrlCreateButton("QA_09", 550, 170, 270, 50, -1) $arrQAButtons[9] = GUICtrlCreateButton("QA_10", 10, 220, 270, 50, -1) $arrQAButtons[10] = GUICtrlCreateButton("QA_11", 280, 220, 270, 50, -1) $arrQAButtons[11] = GUICtrlCreateButton("QA_12", 550, 220, 270, 50, -1) $arrQAButtons[12] = GUICtrlCreateButton("QA_13", 10, 270, 270, 50, -1) $arrQAButtons[13] = GUICtrlCreateButton("QA_14", 280, 270, 270, 50, -1) $arrQAButtons[14] = GUICtrlCreateButton("QA_15", 550, 270, 270, 50, -1) $arrQAButtons[15] = GUICtrlCreateButton("QA_16", 10, 320, 270, 50, -1) $arrQAButtons[16] = GUICtrlCreateButton("QA_17", 280, 320, 270, 50, -1) $arrQAButtons[17] = GUICtrlCreateButton("QA_18", 550, 320, 270, 50, -1) $arrQAButtons[18] = GUICtrlCreateButton("QA_19", 10, 370, 270, 50, -1) $arrQAButtons[19] = GUICtrlCreateButton("QA_20", 280, 370, 270, 50, -1) $arrQAButtons[20] = GUICtrlCreateButton("QA_21", 550, 370, 270, 50, -1) $arrQAButtons[21] = GUICtrlCreateButton("QA_22", 10, 420, 270, 50, -1) $arrQAButtons[22] = GUICtrlCreateButton("QA_23", 280, 420, 270, 50, -1) $arrQAButtons[23] = GUICtrlCreateButton("QA_24", 550, 420, 270, 50, -1) $arrQAButtons[24] = GUICtrlCreateButton("QA_25", 10, 470, 270, 50, -1) $arrQAButtons[25] = GUICtrlCreateButton("QA_26", 280, 470, 270, 50, -1) $arrQAButtons[26] = GUICtrlCreateButton("QA_27", 550, 470, 270, 50, -1) $arrQAButtons[27] = GUICtrlCreateButton("QA_28", 10, 520, 270, 50, -1) $arrQAButtons[28] = GUICtrlCreateButton("QA_29", 280, 520, 270, 50, -1) $arrQAButtons[29] = GUICtrlCreateButton("QA_30", 550, 520, 270, 50, -1) GUISetState() For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_HIDE) GUICtrlSetState($arrShadowButtons[$i], $GUI_HIDE) GUICtrlSetState($arrQAButtons[$i], $GUI_HIDE) Next #EndRegion ---Head-- #Region --- Form --- #Region --- Loop --- While 1 $msg = GUIGetMsg() $EnvironmentSelected = GUICtrlRead($Combo_01) If $EnvironmentSelected <> $Environment Then $bEnvironmentShow = True $Environment = $EnvironmentSelected ConsoleWrite("< @@DEBUG : New EnvironmentSelected <" & $Environment & "> " & @CRLF) EndIf Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ; check if $Environment has changed - otherwise it's flickering If $bEnvironmentShow Then If $Environment = "Production" Then For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_SHOW) GUICtrlSetState($arrShadowButtons[$i], $GUI_HIDE) GUICtrlSetState($arrQAButtons[$i], $GUI_HIDE) Next ElseIf $Environment = "Shadow" Then For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_HIDE) GUICtrlSetState($arrShadowButtons[$i], $GUI_SHOW) GUICtrlSetState($arrQAButtons[$i], $GUI_HIDE) Next ElseIf $Environment = "QA" Then For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_HIDE) GUICtrlSetState($arrShadowButtons[$i], $GUI_HIDE) GUICtrlSetState($arrQAButtons[$i], $GUI_SHOW) Next Else For $i = 0 To UBound($arrProductionButtons) - 1 Step 1 GUICtrlSetState($arrProductionButtons[$i], $GUI_HIDE) GUICtrlSetState($arrShadowButtons[$i], $GUI_HIDE) GUICtrlSetState($arrQAButtons[$i], $GUI_HIDE) Next EndIf $bEnvironmentShow = False EndIf EndSelect WEnd #EndRegion --- Loop --- #Region --- Additional Functions --- #EndRegion --- Additional Functions -- EDIT : The solution of @Subz is better !1 point
-
Array and GUICtrlSetState
Eambo reacted to FrancescoDiMuro for a topic
@Eambo Use an array of controls as showed in the example below:1 point -
What kind of weird behavior is this? You are asking others for help with a script, but you are not willing to post it 🙄. There is certainly a reason why the forum-rules includes the following sentence :1 point
-
Here are two methods to literalize metacharacters in the $sSearch variable. Either using "\Q...\E", or, escaping all metacharacters. #include <Array.au3> Local $Paths = 'C:\Users\' & @CRLF & _ 'C:\EEC (1)\someother file' & @CRLF & _ 'C:\MSfree\' & @CRLF & _ 'C:\EEC (1)\' Local $sSearch = "C:\EEC (1)" ; --------------------- Method 1 ---------------------------------- ; Check if "\E" is in $sSearch. If "\E" is present, replace "\E" with "\E\\E\Q", because of the "\Q" & $sSearch & "\E" in RE pattern. Local $sSearchA = (StringInStr($sSearch, "\E") ? StringReplace($sSearch, "\E", "\E\\E\Q") : $sSearch) ;ConsoleWrite("\Q" & $sSearchA & "\E" & @CRLF) Local $a = StringRegExp($Paths, "(\Q" & $sSearchA & "\E.*)", 3) _ArraySort($a) ;_ArrayDisplay($a) If UBound($a) > 1 Then For $i = 1 To UBound($a) - 1 ; Keep $a1[0] $sSearchB = (StringInStr($a[$i], "\E") ? StringReplace($a[$i], "\E", "\E\\E\Q") : $a[$i]) ;ConsoleWrite("\Q" & $sSearchB & "\E" & @CRLF) Local $sOutput = StringRegExpReplace($Paths, "(\Q" & $sSearchB & "\E\R?)", "") Next Else Local $sOutput = StringRegExpReplace($Paths, "(\Q" & $sSearchA & "\E.*\R?)", "") EndIf MsgBox(0, "\Q...\E", $sOutput) ; Or ; --------------------- Method 2 ---------------------------------- ; Beware "(1)" = (n) - Tests whether the capturing group with absolute number n matched. $sSearch = StringRegExpReplace($sSearch, "([\\()\.^$|\[\]{}*+?#])", "\\$1") ;ConsoleWrite($sSearch & @CRLF) Local $a1 = StringRegExp($Paths, "(" & $sSearch & ".*)", 3) _ArraySort($a1) ;_ArrayDisplay($a1) If UBound($a1) > 1 Then For $i = 1 To UBound($a1) - 1 ; Keep $a1[0] $sSearchC = StringRegExpReplace($a1[$i], "([\\()\.^$|\[\]{}*+?#])", "\\$1") ;ConsoleWrite($sSearchC & @CRLF) Local $sOutput = StringRegExpReplace($Paths, "(" & $sSearchC & "\R?)", "") Next Else Local $sOutput = StringRegExpReplace($Paths, "(" & $sSearch & ".*\R?)", "") EndIf MsgBox(0, "\\,(,)", $sOutput) #cs ; Both methods return:- C:\Users\ C:\MSfree\ C:\EEC (1)\ #ce1 point
-
Hiding many elements cause form flickering
argumentum reacted to _Vlad for a topic
@argumentum I want to thank you. I tested that and helped me optimize. This is a good solution.1 point -
Excel not working after working with Autoit
FrancescoDiMuro reacted to water for a topic
The most common cause: You have opened a Workbook hidden, saved it but forgot to reset the hidden attribute beforehand. How to manually unhide the workbook is described here.1 point -
On 64-bit systems you need to run 64-bit version of cmd, example: ;~ The following script can be compiled as 32-bit #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(False) RunWait(@ComSpec & " /k " &'ssh -o "StrictHostKeyChecking no" user@server' ,"", @SW_SHOW) _WinAPI_Wow64EnableWow64FsRedirection(True) Or just compile the script as 64-bit #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** RunWait(@ComSpec & " /k " &'ssh -o "StrictHostKeyChecking no" user@server' ,"", @SW_SHOW)1 point
-
BotIt FindAndClick
ScrapeYourself reacted to Jos for a topic
We leave this thread open for now, but make sure it will adhere to our forum rules. Jos1 point -
GUI Designer: Koda 1.7.3.0
Professor_Bernd reacted to martin for a topic
That link is now broken. But maybe this one might be helpful for some https://blog.csdn.net/analogous_love/article/details/422646051 point