Jump to content

argumentum

MVPs
  • Posts

    6,214
  • Joined

  • Days Won

    222

argumentum last won the day on August 26

argumentum had the most liked content!

7 Followers

About argumentum

Profile Information

  • Member Title
    ✨Universalist ✨
  • Location
    I'm in your browser now =)
  • WWW
    https://www.youtube.com/watch?v=SjwX-zMRxO0&t=5s
  • Interests
    Relax

Recent Profile Visitors

17,033 profile views

argumentum's Achievements

  1. With a running script but failing for no good reason, you're gonna have to share more than "it works on RDP but not in front of the PC" 🤷‍♂️
  2. 200% scale
  3. So you do want to have it but can not do it because you don't know but can write a registry patch in CMD 🤪 Don't know what to tell you. If you open the help file there are examples that do just that. ...I'll be leaving this post alone. Take your time and learn, is my best advise. Cheers
  4. ...open the help file, ask an AI, and fix the things that the AI got wrong. That's the best way to learn now in 2026. If you wanna hire someone then, that's another story. But if you want to learn, it's good time in history ( because of AI ).
  5. 🤔 ..so, wassup doc. Look, AutoIt is not what you need if your aim is to have the magic of what you are doing hidden. Look for another language but, know that anything done in a PC can be seen by those that are OCD enough to figure it out.
  6. ..I shall obey your command master
  7. My bad. Saw the array and thought "that map..." 😅
  8. use only strings as key because an integer will show to be buggy, eventually.
  9. Run "shell:startup" from the windows right-click menu. That will open the folder where the shortcuts start when the user login.
  10. GUICtrlCreateAvi(@SystemDir & "\shell32.dll", 165, is no longer there ( welcome to the future ). But we can use the one we have: #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create an animation control. ;~ Local $idAvi_Animation = GUICtrlCreateAvi(@SystemDir & "\shell32.dll", 165, 15, 0, 300) Local $idAvi_Animation = GUICtrlCreateAvi(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) - 1) & "\Examples\GUI\sampleAVI.avi", 0, 20, 20, 300, 300) Local $idBtn_Start = GUICtrlCreateButton("Start", 60, 150, 85, 25) Local $idBtn_Stop = GUICtrlCreateButton("Stop", 160, 150, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn_Start ; Start the animation. GUICtrlSetState($idAvi_Animation, $GUI_AVISTART) Case $idBtn_Stop ; Stop the animation. GUICtrlSetState($idAvi_Animation, $GUI_AVISTOP) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example so that the example will show something in Win11 ..another option: to keep it compatible with older systems but it needs more testing Tested in Win7 and shows 31 frames vs. 1 frame in Win11 ..and the why/when above
  11. #include <MsgBoxConstants.au3> ; Returns 1 if muted, 0 if not muted, and sets @error on failure (-1 returned) Func IsMasterVolumeMuted() Local Const $CLSCTX_ALL = 0x17 Local Const $eRender = 0 Local Const $eConsole = 0 ; COM GUIDs Local Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Local Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Local Const $sIID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Local Const $sIID_IAudioEndpointVolume = "{5CDF2C82-841E-4546-9722-0CF74078229A}" ; COM Interface Method Tags Local Const $sTag_IMMDeviceEnumerator = "EnumAudioEndpoints hresult(int;dword;ptr*);" & _ "GetDefaultAudioEndpoint hresult(int;int;ptr*);" Local Const $sTag_IMMDevice = "Activate hresult(struct*;dword;ptr;ptr*);" Local Const $sTag_IAudioEndpointVolume = "RegisterControlChangeNotify hresult(ptr);" & _ "UnregisterControlChangeNotify hresult(ptr);" & _ "GetChannelCount hresult(uint*);" & _ "SetMasterVolumeLevel hresult(float;ptr);" & _ "SetMasterVolumeLevelScalar hresult(float;ptr);" & _ "GetMasterVolumeLevel hresult(float*);" & _ "GetMasterVolumeLevelScalar hresult(float*);" & _ "SetChannelVolumeLevel hresult(uint;float;ptr);" & _ "SetChannelVolumeLevelScalar hresult(uint;float;ptr);" & _ "GetChannelVolumeLevel hresult(uint;float*);" & _ "GetChannelVolumeLevelScalar hresult(uint;float*);" & _ "SetMute hresult(bool;ptr);" & _ "GetMute hresult(bool*);" ; MMDeviceEnumerator COM object Local $oEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $sTag_IMMDeviceEnumerator) If @error Or Not IsObj($oEnumerator) Then Return SetError(1, 0, -1) ; Get Default Audio Endpoint Pointer Local $pDevice = 0 Local $hResult = $oEnumerator.GetDefaultAudioEndpoint($eRender, $eConsole, $pDevice) If $hResult <> 0 Or Not $pDevice Then Return SetError(2, 0, -1) ; Wrap IMMDevice interface pointer Local $oDevice = ObjCreateInterface($pDevice, $sIID_IMMDevice, $sTag_IMMDevice) If @error Or Not IsObj($oDevice) Then Return SetError(3, 0, -1) ; IAudioEndpointVolume IID string to binary struct for Activate Local $tIID_EndpointVol = DllStructCreate("byte[16]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sIID_IAudioEndpointVolume, "struct*", $tIID_EndpointVol) ; Activate IAudioEndpointVolume interface Local $pEndpointVolume = 0 $hResult = $oDevice.Activate($tIID_EndpointVol, $CLSCTX_ALL, 0, $pEndpointVolume) If $hResult <> 0 Or Not $pEndpointVolume Then Return SetError(4, 0, -1) ; Wrap IAudioEndpointVolume interface pointer Local $oEndpointVolume = ObjCreateInterface($pEndpointVolume, $sIID_IAudioEndpointVolume, $sTag_IAudioEndpointVolume) If @error Or Not IsObj($oEndpointVolume) Then Return SetError(5, 0, -1) ; Query Mute state Local $bMuted = False $hResult = $oEndpointVolume.GetMute($bMuted) If $hResult <> 0 Then Return SetError(6, 0, -1) Return ($bMuted ? 1 : 0) EndFunc ;==>IsMasterVolumeMuted Local $iMuted = IsMasterVolumeMuted() If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Failed to query volume status. Code: " & @error) Else MsgBox($MB_SYSTEMMODAL, "Master Volume Status", ($iMuted ? "MUTED" : "NOT MUTED")) EndIf try this one Edit: This will help too #include <MsgBoxConstants.au3> ; Returns master volume as a percentage (0 to 100), and sets @error on failure Func GetMasterVolumeLevel() Local Const $CLSCTX_ALL = 0x17, $eRender = 0, $eConsole = 0 Local Const $sCLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Local Const $sIID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Local Const $sIID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Local Const $sIID_IAudioEndpointVolume = "{5CDF2C82-841E-4546-9722-0CF74078229A}" Local Const $sTag_IMMDeviceEnumerator = "EnumAudioEndpoints hresult(int;dword;ptr*);" & _ "GetDefaultAudioEndpoint hresult(int;int;ptr*);" Local Const $sTag_IMMDevice = "Activate hresult(struct*;dword;ptr;ptr*);" Local Const $sTag_IAudioEndpointVolume = "RegisterControlChangeNotify hresult(ptr);" & _ "UnregisterControlChangeNotify hresult(ptr);" & _ "GetChannelCount hresult(uint*);" & _ "SetMasterVolumeLevel hresult(float;ptr);" & _ "SetMasterVolumeLevelScalar hresult(float;ptr);" & _ "GetMasterVolumeLevel hresult(float*);" & _ "GetMasterVolumeLevelScalar hresult(float*);" & _ "SetChannelVolumeLevel hresult(uint;float;ptr);" & _ "SetChannelVolumeLevelScalar hresult(uint;float;ptr);" & _ "GetChannelVolumeLevel hresult(uint;float*);" & _ "GetChannelVolumeLevelScalar hresult(uint;float*);" & _ "SetMute hresult(bool;ptr);" & _ "GetMute hresult(bool*);" Local $oEnumerator = ObjCreateInterface($sCLSID_MMDeviceEnumerator, $sIID_IMMDeviceEnumerator, $sTag_IMMDeviceEnumerator) If @error Or Not IsObj($oEnumerator) Then Return SetError(1, 0, -1) Local $pDevice = 0 If $oEnumerator.GetDefaultAudioEndpoint($eRender, $eConsole, $pDevice) <> 0 Or Not $pDevice Then Return SetError(2, 0, -1) Local $oDevice = ObjCreateInterface($pDevice, $sIID_IMMDevice, $sTag_IMMDevice) If @error Or Not IsObj($oDevice) Then Return SetError(3, 0, -1) Local $tIID_EndpointVol = DllStructCreate("byte[16]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sIID_IAudioEndpointVolume, "struct*", $tIID_EndpointVol) Local $pEndpointVolume = 0 If $oDevice.Activate($tIID_EndpointVol, $CLSCTX_ALL, 0, $pEndpointVolume) <> 0 Or Not $pEndpointVolume Then Return SetError(4, 0, -1) Local $oEndpointVolume = ObjCreateInterface($pEndpointVolume, $sIID_IAudioEndpointVolume, $sTag_IAudioEndpointVolume) If @error Or Not IsObj($oEndpointVolume) Then Return SetError(5, 0, -1) Local $fScalar = 0.0 ; GetMasterVolumeLevelScalar returns a float value between 0.0 (0%) and 1.0 (100%) If $oEndpointVolume.GetMasterVolumeLevelScalar($fScalar) <> 0 Then Return SetError(6, 0, -1) Return Round($fScalar * 100) EndFunc Local $iVol = GetMasterVolumeLevel() If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Failed to query volume level. Code: " & @error) Else MsgBox($MB_SYSTEMMODAL, "Master Volume Level", "Current Volume: " & $iVol & "%") EndIf
  12. place your mouse on the other monitor then run the script. Is just a way for .. testing ? 🤔
  13. ..I'll do you one better: #AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <WindowsStylesConstants.au3> #include <GuiEdit.au3> #include <FontConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsNotifsConstants.au3> #include <WindowsConstants.au3> #include "PMv2.au3" _PM_Init() Global $g_hStatus, $g_hGui, $g_idAboutOK = Null Example() Func Example() Local Const $fDefFontSize = 8.5, $fDefPixel = $fDefFontSize * 96 / 72 Local $iCtrlSpaceV = 10 Local $sAppName = "High DPI Scaling Example" Local $hGUI = GUICreate($sAppName, 400, 300) ;Local $hGUI = GUICreate($sAppName, 330, 260, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP)) GuiCenterOnMonitorFromMousePosition($hGUI) $g_hGui = $hGUI ; Get DPI Awareness Context Local $hContext = _WinAPI_GetWindowDpiAwarenessContext($hGUI) Local $hStatus = _GUICtrlStatusBar_Create($hGUI) $g_hStatus = $hStatus Local $idMnu_File = GUICtrlCreateMenu("&File") Local $idMnu_View = GUICtrlCreateMenu("View") Local $idMnu_Help = GUICtrlCreateMenu("Help") Local $idMni_Info = GUICtrlCreateMenuItem("About", $idMnu_Help) Local $idMni_Exit = GUICtrlCreateMenuItem("Exit", $idMnu_File) Local $idStatusShow = GUICtrlCreateMenuItem("Status Bar", $idMnu_View) GUICtrlSetState($idStatusShow, $GUI_CHECKED) ; Create new scaled font Local Static $hCtrlFont = _WinAPI_CreateFont(-Round($fDefPixel), 0, 0, 0, $FW_NORMAL, False, False, False, _ $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $PROOF_QUALITY, $DEFAULT_PITCH, "Segoe UI") Local $idTestName = GUICtrlCreateLabel("Test Label ", 15, 20, 180, 24) Local $aPos = ControlGetPos($hGUI, "", $idTestName) Local $iPrev = $aPos[1] + $aPos[3] + $iCtrlSpaceV GUICtrlSetFont(-1, 10, $FW_NORMAL, $GUI_FONTNORMAL, "Comic Sans MS") Local $idTestInput = GUICtrlCreateInput("Test Input", 15, $iPrev, 260, 22) $aPos = ControlGetPos($hGUI, "", $idTestInput) $iPrev = $aPos[1] + $aPos[3] + $iCtrlSpaceV GUICtrlSetFont(-1, 8.5, $FW_NORMAL, $GUI_FONTUNDER, "Segoe UI") Local $idCheckbox1 = GUICtrlCreateCheckbox("Test Checkbox1 ", 15, $iPrev, -1, -1) $aPos = ControlGetPos($hGUI, "", $idCheckbox1) $iPrev = $aPos[1] + $aPos[3] + $iCtrlSpaceV GUICtrlSetFont(-1, 8.5, $FW_NORMAL, $GUI_FONTSTRIKE, "Segoe UI") Local $idCheckbox2 = GUICtrlCreateCheckbox("Test Checkbox2 ", 15, $iPrev, -1, -1) $aPos = ControlGetPos($hGUI, "", $idCheckbox2) $iPrev = $aPos[1] + $aPos[3] + $iCtrlSpaceV GUICtrlSetFont(-1, 8.5, $FW_NORMAL, $GUI_FONTNORMAL, "Segoe UI") Local $hEditCtrl = _GUICtrlEdit_Create($hGUI, "This was created with standard UDF" & @CRLF & "function _GUICtrlEdit_Create().", 15, $iPrev, 300, 64) _SendMessage($hEditCtrl, $WM_SETFONT, $hCtrlFont, True) ; Set statusbar text Local $fDpiScale = __PM_GetWindowDPI($g_hGui) / 96 Local $aParts[3] = [72 * $fDpiScale, 200 * $fDpiScale, -1] _GUICtrlStatusBar_SetParts($g_hStatus, $aParts) _GUICtrlStatusBar_SetText($g_hStatus, __PM_GetWindowDPI($g_hGui) & "dpi", 0) _GUICtrlStatusBar_SetText($g_hStatus, (__PM_GetWindowDPI($g_hGui) / 96) * 100 & "% scaling", 1) _GUICtrlStatusBar_SetText($g_hStatus, _GetDpiAwarenessContextName($hContext), 2) ; Register custom window message for the purpose of updating statusbar text GUIRegisterMsg($__PM_WM_DPICHANGED, "_WM_DPICHANGED") _PM_Scale($hGUI) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $idStatusShow Local $bStatusShow If $hStatus Then $bStatusShow = _WinAPI_IsWindowVisible($hStatus) Switch $bStatusShow Case 1 _GUICtrlStatusBar_ShowHide($hStatus, @SW_HIDE) GUICtrlSetState($idStatusShow, $GUI_UNCHECKED) Case 0 _GUICtrlStatusBar_ShowHide($hStatus, @SW_SHOW) GUICtrlSetState($idStatusShow, $GUI_CHECKED) EndSwitch EndIf Case $idMni_Info ;~ MsgBox($MB_TOPMOST, "PMv2", "PMv2 Version: " & _PM_Version() & @CRLF) _AboutGUI() Case $GUI_EVENT_CLOSE, $idMni_Exit, $g_idAboutOK If WinGetTitle("[ACTIVE]") = "About PMv2" Then GUIDelete(WinGetHandle("About PMv2")) ContinueLoop EndIf ExitLoop EndSwitch WEnd If $hCtrlFont Then _WinAPI_DeleteObject($hCtrlFont) GUIDelete($hGUI) EndFunc ;==>Example Func _WM_DPICHANGED($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam ; Obtain new DPI value (raw) Local $iDPI = _WinAPI_LoWord($wParam) Local $hContext = _WinAPI_GetWindowDpiAwarenessContext($hWnd) Local $fDpiScale = $iDPI / 96 Local $aParts[3] = [72 * $fDpiScale, 200 * $fDpiScale, -1] _GUICtrlStatusBar_SetParts($g_hStatus, $aParts) _GUICtrlStatusBar_SetText($g_hStatus, $iDPI & "dpi", 0) _GUICtrlStatusBar_SetText($g_hStatus, ($iDPI / 96) * 100 & "% scaling", 1) _GUICtrlStatusBar_SetText($g_hStatus, _GetDpiAwarenessContextName($hContext), 2) Return 0 EndFunc ;==>_WM_DPICHANGED Func _AboutGUI() Local $hGUIAbout = GUICreate("About PMv2", 240, 100) GUICtrlCreateLabel("PMv2 Version: " & _PM_Version(), 10, 20, 220, 25) GUICtrlSetFont(-1, 12, $FW_NORMAL, $GUI_FONTNORMAL, "Comic Sans MS") $g_idAboutOK = GUICtrlCreateButton("OK", 70, 70, 100, 25) GUISetState(@SW_SHOW, $hGUIAbout) EndFunc ;==>_AboutGUI Func GuiCenterOnMonitorFromMousePosition($hForm, $sText = "") ; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/page/22/#findComment-1479329 Local $aData, $hMonitor, $tPos = _WinAPI_GetMousePos() If Not @error Then $hMonitor = _WinAPI_MonitorFromPoint($tPos) If Not @error Then $aData = _WinAPI_GetMonitorInfo($hMonitor) If @error Then Return SetError(1, -1, 1) Local $iWinState = WinGetState($hForm, $sText) If @error Then Return SetError(2, $aData[2], 2) If BitAND($iWinState, $WIN_STATE_MINIMIZED) Or _ BitAND($iWinState, $WIN_STATE_MAXIMIZED) Then WinSetState($hForm, $sText, @SW_RESTORE) Local $aWinPos = WinGetPos($hForm, $sText) If @error Then Return SetError(3, $aData[2], 3) WinMove($hForm, _ $sText, _ Int((($aData[0].Right - $aData[0].Left - $aWinPos[2]) / 2) + $aData[0].Left), _ Int((($aData[0].Bottom - $aData[0].Top - $aWinPos[3]) / 2) + $aData[0].Top)) If @error Then Return SetError(4, $aData[2], 4) Return SetError(0, $aData[2], 0) EndFunc ;==>GuiCenterOnMonitorFromMousePosition
  14. disable in the UDF it's use so that scripts will run regardless, just without the goodies.
  15. WinGetPos() of the window and add the distance to that X,Y of the blue button 🤔
×
×
  • Create New...