Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/09/2021 in all areas

  1. In this thread it was mentioned how a software could manage single/multiple monitors. I was curious to see how it could be possible to make it work without the tool. So I made a script that change brightness (VCP 10) of my primary monitor for a few seconds. To learn about the VCP commands refer to : https://www.ddcutil.com/vcpinfo_output/ Among other commands, you can turn on/off (VCP D6) secondary monitor, change contrast (VCP 12), etc. In the example you can see (and parse) all commands allowed by your monitor(s). #include <String.au3> #include <Array.au3> #include <WinAPIGdi.au3> #include <WinAPISysWin.au3> Local $aPos, $aData = _WinAPI_EnumDisplayMonitors() If IsArray($aData) Then ReDim $aData[$aData[0][0] + 1][5] For $i = 1 To $aData[0][0] $aPos = _WinAPI_GetPosFromRect($aData[$i][1]) For $j = 0 To 3 $aData[$i][$j + 1] = $aPos[$j] Next Next EndIf _ArrayDisplay($aData, '_WinAPI_EnumDisplayMonitors') Local $hWnd = _WinAPI_GetDesktopWindow() ConsoleWrite($hWnd & @CRLF) $hMonitor = _WinAPI_MonitorFromWindow($hWnd, $MONITOR_DEFAULTTONEAREST) ConsoleWrite($hMonitor & @CRLF) Local $aRet = DllCall("Dxva2.dll", "int", "GetNumberOfPhysicalMonitorsFromHMONITOR", "handle", $hMonitor, "int*", 0) ;_ArrayDisplay($aRet) Local $iNumberMonitor = $aRet[2] Const $tag_PHYSICAL_MONITOR = "handle hPhysicalMonitor; wchar strPhysicalMonitorDescription[128];" Local $tPhysicalMonitor = DllStructCreate(_StringRepeat($tag_PHYSICAL_MONITOR, $iNumberMonitor)) $aRet = DllCall("Dxva2.dll", "int", "GetPhysicalMonitorsFromHMONITOR", "handle", $hMonitor, "int", $iNumberMonitor, "struct*", $tPhysicalMonitor) ;_ArrayDisplay($aRet) MsgBox($MB_SYSTEMMODAL, "", $tPhysicalMonitor.strPhysicalMonitorDescription) $aRet = DllCall("Dxva2.dll", "int", "GetCapabilitiesStringLength", "handle", $tPhysicalMonitor.hPhysicalMonitor, "int*", 0) ;_ArrayDisplay($aRet) Local $iLength = $aRet[2] + 1 Local $tCapabilities = DllStructCreate("char sCapabilities[" & $iLength & "];") $aRet = DllCall("Dxva2.dll", "int", "CapabilitiesRequestAndCapabilitiesReply", "handle", $tPhysicalMonitor.hPhysicalMonitor, _ "ptr", DllStructGetPtr($tCapabilities), "int", $iLength) ;_ArrayDisplay($aRet) ConsoleWrite($tCapabilities.sCapabilities & @CRLF) Local Enum $MC_MOMENTARY, $MC_SET_PARAMETER ; _MC_VCP_CODE_TYPE $aRet = DllCall("Dxva2.dll", "int", "GetVCPFeatureAndVCPFeatureReply", "handle", $tPhysicalMonitor.hPhysicalMonitor, _ "byte", 0x10, "int*", 0, "int*", 0, "int*", 0) ;_ArrayDisplay($aRet) ConsoleWrite($aRet[3] = $MC_MOMENTARY ? "Momentary" : ($aRet[3] = $MC_SET_PARAMETER ? "Set" : "Unknown") & @CRLF) ConsoleWrite("Current value = " & $aRet[4] & "/" & "Maximum = " & $aRet[5] & @CRLF) Local $iCurrent = $aRet[4] $aRet = DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, _ "byte", 0x10, "int", 20) Sleep(5000) $aRet = DllCall("Dxva2.dll", "int", "SetVCPFeature", "handle", $tPhysicalMonitor.hPhysicalMonitor, _ "byte", 0x10, "int", $iCurrent) $aRet = DllCall("Dxva2.dll", "int", "DestroyPhysicalMonitors", "int", $iNumberMonitor, "ptr", DllStructGetPtr($tPhysicalMonitor)) ;_ArrayDisplay($aRet)
    1 point
  2. Hello everyone I am happy to share this UDF with you which, as you may have read from the title, allows you to emulate multithreading without memory or functionality limitations. This UDF permit you to initialize different process and execute all code you want,is verry seample exciange information between Threads using this UDF. This system is good because allow you to execute any kind of code in backgorund or not, with no limitations. Sure you have to deal with the message system to turn them into commands and data exchange but it's not that complicated, anyway I'm working on it. Let me know for improvements... AutoThreadV3.au3 AutoitMultiThread Example.au3
    1 point
  3. jimmy123j, OK, I can reproduce the problem and know what is happening. Now I need to see why it happens! M23 I think I have found the solution - try this code and see if it works for you too: GUIListViewEx_Test.au3
    1 point
  4. Did you enable script execution ? Try using : $pid = Run(@ComSpec & " /K " & $sCMD, @ScriptDir, @SW_SHOW) To see if you got any kind of error... BTW, why do you insist using powershell for such an easy task in AutoIt ? (see ProcessList function)
    1 point
  5. water

    Active Directory UDF (II)

    Simply use Global $aResult = _AD_GetObjectAttribute(@ComputerName & "$", "distinguishedName") You get a string holding the distinguished name.
    1 point
  6. Pretty much everything is perfectly well described in help file (AutoIt.chm). Make sure you also download FULL version of Scite. When you download AutoIt, you only get a light version of the editor. So you need to get and install full version separately.
    1 point
  7. Hi jimmy123j, I had the same issue with the dotted rectangle when the item is focused. @LarsJ provided a solution that worked fine for me and it seems to solve your problem too. 1) Running your original script, the focused item is surrounded with the dotted rectangle : 2) With the additional line of code (placed immediately after the listview creation), the dotted rectangle has gone : $Window2_List = GUICtrlCreateListView("Item 1|Item 2|Item 3|Item 4|Item 5", 0, 0, 400, 200, $LVS_REPORT + $LVS_SINGLESEL, $LVS_EX_FULLROWSELECT + $WS_EX_CLIENTEDGE) _GUICtrlListView_SetCallBackMask($Window2_List, 4) ; "disable state information about focused item" (LarsJ) . Can be useful (keep that line)
    1 point
  8. You should know by now that without a basic code, you will not get much response. Make an effort on your part if you want help...
    1 point
  9. KANIFUSA, Here you go: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 888, 583, -1, -1) $Pic1_1 = GUICtrlCreatePic("form1.bmp", -0, -0,888, 583) GUICtrlSetState($Pic1_1, $GUI_DISABLE) $Button1_1 = GUICtrlCreateButton("Button GUI Form2", 240, 52, 205, 102) $Button1_2 = GUICtrlCreateButton("2", 448, 52, 100, 102) $Button1_3 = GUICtrlCreateButton("3", 564, 52, 101, 102) $Button1_4 = GUICtrlCreateButton("4", 668, 52, 101, 102) $Button1_5 = GUICtrlCreateButton("5", 772, 52, 101, 102) $Button1_6 = GUICtrlCreateButton("6", 240, 157, 101, 102) $Button1_7 = GUICtrlCreateButton("7", 344, 157, 101, 102) $Button1_8 = GUICtrlCreateButton("8", 448, 157, 100, 102) $Button1_9 = GUICtrlCreateButton("9", 564, 157, 101, 102) $Button1_10 = GUICtrlCreateButton("10", 668, 157, 101, 102) $Button1_11 = GUICtrlCreateButton("11", 772, 157, 101, 102) $Button1_12 = GUICtrlCreateButton("12", 240, 261, 205, 102) $Button1_13 = GUICtrlCreateButton("13", 448, 261, 100, 102) $Button1_14 = GUICtrlCreateButton("14", 564, 261, 101, 102) $Button1_15 = GUICtrlCreateButton("15", 668, 261, 205, 102) $Button1_16 = GUICtrlCreateButton("16", 240, 365, 205, 102) $Button1_17 = GUICtrlCreateButton("17", 448, 365, 100, 102) $Button1_18 = GUICtrlCreateButton("18", 564, 365, 101, 102) $Button1_19 = GUICtrlCreateButton("19", 668, 365, 101, 102) $Button1_20 = GUICtrlCreateButton("20", 772, 365, 101, 102) GUISetState(@SW_SHOW) $Form2 = GUICreate("Form2", 392, 623, -1, -1) $Pic2_1 = GUICtrlCreatePic("form2.bmp", 0, 0, 392, 623) GUICtrlSetState($Pic2_1, $GUI_DISABLE) $Button2_1 = GUICtrlCreateButton("Button GUI Form1", 56, 36, 325, 165) $Button2_2 = GUICtrlCreateButton("Button2", 72, 208, 145, 73) $Button2_3 = GUICtrlCreateButton("Button3", 224, 208, 145, 73) $Button2_4 = GUICtrlCreateButton("Button4", 72, 320, 145, 73) $Button2_5 = GUICtrlCreateButton("Button5", 224, 320, 145, 73) $Button2_6 = GUICtrlCreateButton("Button6", 72, 424, 145, 73) $Button2_7 = GUICtrlCreateButton("Button7", 224, 424, 145, 73) GUISetState(@SW_HIDE) While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $Form1 Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $Button1_1 GUISetState(@SW_HIDE, $Form1) GUISetState(@SW_SHOW, $Form2) EndSwitch Case $Form2 Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $Button2_1 GUISetState(@SW_HIDE, $Form2) GUISetState(@SW_SHOW, $Form1) EndSwitch EndSwitch WEndYou should read the http://www.autoitscript.com/wiki/Managing_Multiple_GUIs tutorial in the Wiki to understand what is going on. M23
    1 point
×
×
  • Create New...