Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/10/2022 in all areas

  1. Sigh. Another easy one (for now) lol.
    1 point
  2. Nine

    Column Header Color

    Here a streamlined version : #include <GuiConstants.au3> #include <FontConstants.au3> #include <GuiListView.au3> #include <Constants.au3> #include <WinAPISysWin.au3> #include <WinAPITheme.au3> Opt('MustDeclareVars', True) Global $hHeader Example() Func Example() Local $hGUI = GUICreate("Listview Color Header", 500, 300) Local $idListView = GUICtrlCreateListView("Items List|SubList 1|SubList 2", 10, 10, 480, 280) _GUICtrlListView_SetExtendedListViewStyle($idListView, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) $hHeader = GUICtrlSendMsg($idListView, $LVM_GETHEADER, 0, 0) _WinAPI_SetWindowTheme($hHeader, "", "") ;Turn off theme for header Local $iStyle = _WinAPI_GetWindowLong($hHeader, $GWL_STYLE) _WinAPI_SetWindowLong($hHeader, $GWL_STYLE, BitOR($iStyle, $HDS_FLAT)) ; remove header 3D button effect For $i = 1 To 10 _GUICtrlListView_AddItem($idListView, "Item" & $i) _GUICtrlListView_AddSubItem($idListView, $i - 1, "SubItem" & $i, 1) _GUICtrlListView_AddSubItem($idListView, $i - 1, "SubItem" & $i, 2) Next _GUICtrlListView_SetColumnWidth($idListView, 0, $LVSCW_AUTOSIZE_USEHEADER) _GUICtrlListView_SetColumnWidth($idListView, 1, $LVSCW_AUTOSIZE_USEHEADER) _GUICtrlListView_SetColumnWidth($idListView, 2, $LVSCW_AUTOSIZE_USEHEADER) GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) If $tNMHDR.hWndFrom = $hHeader And $tNMHDR.Code = $NM_CUSTOMDRAW Then Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Switch $tCustDraw.dwDrawStage Case $CDDS_PREPAINT Return $CDRF_NOTIFYITEMDRAW Case $CDDS_ITEMPREPAINT _WinAPI_SetTextColor($tCustDraw.hDC, 0) _WinAPI_SetBkColor($tCustDraw.hDC, 0x00FFFF) Return $CDRF_NEWFONT EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
    1 point
  3. Only parts of it would be useful and I don't plan to use it if I were to clean it up. There's a lot of customization that I've put into it, like setting up my webdriver exactly the way I want it. It wouldn't be useful to me without it or useful to you with it I will give you my most used function, though. Despite its simplicity, I use it ALL the time.
    1 point
  4. My idea was to show a first result as fast as possible, to make it look instantly, then do the rest in background. You can test it with a lot of matches, you will see the difference...
    1 point
  5. Hi VAN0, I think you did well by adding a transparent label that covers the edit box, making the GUI draggable. It takes just 1 line of code and does the job. It's useful especially when the GUI got no caption. "About hiding cursor in edit box" : @jguinch showed a way to do it in this script, by registering WM_COMMAND and testing EN_SETFOCUS. You can see the difference in his script when you run it again, after commenting out the line : ; GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND') But you also "don't want to allow text selection, aka making [the edit control] visibly a true label element" If you're ok with the fact that the front color of the edit box won't be black as night, then this could help : #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> Local $hForm = GUICreate('Test' , 400, 250) GUICtrlCreateLabel("", 10, 10, 380, 100, -1, $GUI_WS_EX_PARENTDRAG) ; => $Input1 draggable Local $Input1 = GUICtrlCreateEdit('No caret inside + Not selectable', 10, 10, 380, 100, _ $WS_HSCROLL + $WS_VSCROLL + $ES_READONLY) ; GUICtrlSetColor(-1, 0x000000) ; front color : black (doesn't work on disabled control) GUICtrlSetBkColor(-1, 0xFFFFFF) ; back color : white (works on disabled control) GUICtrlSetFont(-1, Default, 900) ; boldest (to appear a bit 'less grey' on disabled control) GUICtrlSetState(-1, $GUI_DISABLE) Local $Input2 = GUICtrlCreateEdit('Caret inside + selectable', 10, 110, 380, 100) Local $Button = GUICtrlCreateButton('Exit', 300, 220, 90, 20) Local $msg GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE OR $msg = $Button Then Exit WEnd @Melba23 indicated in this script : GUICtrlSetBackColor does work on disabled controls, although GUICtrlSetColor appears not to. Good luck
    1 point
  6. MS tells us that the userWorkstations attribute should not be used any longer: https://docs.microsoft.com/en-za/windows/win32/adschema/a-userworkstations Recommended setting is described here: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/allow-log-on-locally Might be the cause of your problem. Good reading: http://woshub.com/restrict-workstation-logon-ad-users/
    1 point
  7. Are you sure the attribute is being replicated between DCs? In our environment the isMemberOfPartialAttributeSet is set to null meaning it's not replicated. To verify used the following: Computer running script is connected to DC1 Added @ComputerName to userWorkstations attribute on DC2 nb: Noticed that the data wasn't replicated to DC1 Running the script I received the same results as above Added @ComputerName to userWorkstations attribute on DC1 Ran the script without error and it returned the @ComputerName correctly
    1 point
  8. It's about the declaration of the variable, i.e. prefixing a variable with Local, Global etc... or in this case when used with For..In..Next (see remarks) it's declaring the variable as Local $p. Using: $p = $i is modifying the variable value but not declaring it as Local or Global, this can get confusing as AutoIt doesn't require you to declare variables scope unless you use the MustDeclareVars so for example: $g_sGlobalVar1 = "Global Var, although not explicitly declared" Global $g_sGlobalVar2 = "Global Var, explicitly declared" Local $g_sGlobalVar3 = "Global Var, as it's outside of a function, even though it was declared as Local" _MyFunc() Func _MyFunc() $sLocalVar1 = "Local Var, although not explicitly defined" Local $sLocalVar2 = "Local Var, explicitly declared" $g_sGlobalVar2 = "Global Var, which has already been declared above, this would change it's value" Global $g_sGlobalVar4 = "Global Var, while you can declare global variables, it is not recommended and would only be available after _MyFunc() is called" For $i = 1 to 3 ;~ $i is declared as a local variable $i += 1 ;~ $i value is modified not being declared Next EndFunc Hope that makes sense, although my terminology might be off.
    1 point
  9. You could do this: _DefaultBroswerLoadPage() Func _DefaultBroswerLoadPage() Local $sUrl = "http://localhost:80" TCPStartup() $iMainSocket = TCPListen("127.0.0.1", 80) ShellExecute($sUrl) Local $iConnectedSocket = -1 Local $hTimer = TimerInit() Local $bErrorTimeout = False Do Sleep(300) $iConnectedSocket = TCPAccept($iMainSocket) If TimerDiff($hTimer) > (1000 * 5) Then $bErrorTimeout = True ExitLoop EndIf Until $iConnectedSocket <> -1 If $bErrorTimeout Then TCPShutdown() Return "" EndIf Local $sReceived = TCPRecv($iConnectedSocket, 1024) ;~ $sReceived = BinaryToString($sReceived, 4) TCPSend($iConnectedSocket, '<h1 style="text-align: center;color: blue;font-size: 40px;">AutoIt Rocks</h1><p style="color: red; font-size: 30px;text-align: center;">@AutoItVersion: ' & @AutoItVersion & '<br><br>' & "@AutoItPID: " & @AutoItPID & '</p>') If $iConnectedSocket <> -1 Then TCPCloseSocket($iConnectedSocket) TCPShutdown() EndFunc ;==>_DefaultBroswerLoadPage Saludos
    1 point
  10. With WebDriver, you could likely avoid the temp file by passing the HTML as a parameter to _WD_ExecuteScript and use javascript to write the HTML directly to the browser. Without WebDriver, I would simply write the HTML to a temp file and then launch it with ShellExecute().
    1 point
×
×
  • Create New...