Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/07/2023 in all areas

  1. willichan

    CornedBeef Hash (UDF)

    A reasonably speedy and overly simplistic hash generator (definately not a cryptographic hash) I had a minor project that I didn't feel like putting in the effort to use any recognized hashing algorithm, so I made this one as a quick and dirty, just "for sh*ts and giggles" algorithm. Useable, but don't take it seriously. Maybe just an example of how you can compartmentalize your UDF and avoid using global variables. CornedBeefHash.au3
    1 point
  2. Andreik

    Pause and Play example

    Not sure about what confusion are you talking but this is a trivial thing. This is how I implement pause in my apps: HotKeySet('{PAUSE}', 'Pause') While True ConsoleWrite('The script is running.' & @CRLF) Sleep(10) WEnd Func Pause() Local Static $Paused = False $Paused = Not $Paused If $Paused Then ConsoleWrite('The script is paused.' & @CRLF) Do Sleep(10) Until Not $Paused EndFunc
    1 point
  3. According to my limited experience under Win 11, winmm.dll can intrinsically play back mp3, wma, wav, asf, avi and wmv files, and additional codecs are required to play back other popular file types such as flac, ogg, mp4, mkv, flv and webm.
    1 point
  4. jchd

    sqlite viewer

    I warmly recommend SQLite Expert.
    1 point
  5. If you press anything any other key before Win key the Start Menu don't pop up. Anyway you can use a keyboard hook to prevent the system from passing the message to the rest of the hook chain and you can process the key by your own will. Here is an example. #include <WinAPIConstants.au3> #include <StructureConstants.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> Global $Exit = False Global $hProc = DllCallbackRegister("KeyboardProc", "long", "int;wparam;lparam") Global $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hProc), _WinAPI_GetModuleHandle(0)) Do Sleep(10) Until $Exit _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hProc) Func KeyboardProc($nCode, $wParam, $lParam) Local $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndIf If $wParam = $WM_KEYDOWN Then Local $vkCode = DllStructGetData($tKEYHOOKS, "vkCode") Local $flags = DllStructGetData($tKEYHOOKS, "flags") ConsoleWrite($vkCode & @CRLF) If $vkCode = 27 Then $Exit = True If $vkCode = 91 Then ;~ ProcessYourWinKey() Return 1 EndIf EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc
    1 point
  6. Andreik

    sqlite viewer

    I use this one: DB Browser for SQLite. I like it because it's free, portable and kinda lightweight. There are plenty others on sourceforge.
    1 point
  7. #include <GUIConstants.au3> #include <ColorConstants.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <ColorConstants.au3> #include <AutoItConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> ; Declare the control ID as a global variable Func Delete_User() Local $hGUI = GUICreate("Delete User", 300, 250, -1, -1) Local $label = GUICtrlCreateLabel("Write your Username in wich you want to delete. If you have a Gramatic error it wont delete the user. If you need help contact IT member Alexander Wiens. (Interna 7312)", 50, 70, 200, 80) Local $username = GUICtrlCreateInput("", 50, 10, 200, 20) Local $userpasscode = GUICtrlCreateInput("", 50, 40, 200, 20, $ES_PASSWORD) Local $button_delete = GUICtrlCreateButton("Delete", 170, 150, 60, 40) Local $button_exit = GUICtrlCreateButton("Exit", 80, 150, 60, 40) GUICtrlSetColor($button_delete, 0xFF2D00) GUICtrlSetColor($button_exit, 0x00F00) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $button_exit Exit Case $button_delete $sUsername = GUICtrlRead($username) ; << ----- You need to read the text from the control $sPassword = GUICtrlRead($userpasscode) ; << ----- You need to read the text from the control $existsuser = IniRead("C:\Users\Alexander_2 Wiens\Documents\Data-User\USER.properties", $sUsername, "User", False) ; << -- Use it here $rightpassword = IniRead("C:\Users\Alexander_2 Wiens\Documents\Data-User\USER.properties", $sUsername, "Passcode", False) ; << -- And here MsgBox($MB_OK, "Read", $existsuser) If $existsuser == $sUsername Then ; << ----- Compare with what you read from control MsgBox($MB_OK, "Tada", "More Tada") ElseIf $existsuser == False Then MsgBox($MB_OK, "ERROR", "The user or the passcode is wrong") ElseIf $existsuser == "aw08" Then MsgBox($MB_OK, "ERROR", "That is wierd!") Else MsgBox($MB_OK, "ERROR", "I don't get it...") EndIf EndSwitch WEnd EndFunc Delete_User()
    1 point
  8. after some time of use, I added some more functions, and converted it to udf, for simpler use e.g.: _MM_WinMoveOn($hWin, 10, 10, 600, 300, -1, "\\.\DISPLAY2", False) moves the specify win to position 10, 10, 600, 300 on monitor2 MultiMonitors.au3 Moves and arranges with relative coords to the active monitor ; #FUNCTION# ========================================================================================================= ; ==================================================================================================================== MultiMonitors.au3 #AutoIt3Wrapper_Run_AU3Check=Y #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 6 -w 7 #AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y #AutoIt3Wrapper_UseX64=n ; *<- DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; -4=PerMonitorAwareV2 #include-once ; #INDEX# ============================================================================================================ ; Title .........: MultiMonitors.au3 ; AutoIt Version : v3.3.16.1 or higher ; Language ......: English ; Description ...: Moves and arranges with relative coords to the active monitor ; Remarks .......: ; Note ..........: My first UDF :) Tested on Windows 10 Version 22H2 ; Author(s) .....: ioa747 ; Link...........: https://www.autoitscript.com/forum/topic/210826-moves-andor-resizes-and-arrange-windows-between-multi-monitors/ ; ==================================================================================================================== ; #INCLUDES# ========================================================================================================= #include <Array.au3> #include <WinAPIGdi.au3> #include <WindowsConstants.au3> ; #GLOBAL VARIABLES# ================================================================================================= ; ==================================================================================================================== ; Initialization DllCall("user32.dll", "bool", "SetProcessDpiAwarenessContext", "int", -4) ; -4=PerMonitorAwareV2 ; #CURRENT# ========================================================================================================== ; _MM_WinBySide: Moves and/or resizes and arrange windows between multi monitors. ; _MM_WinMoveOn: Moves and/or resizes a window between multi monitors. ; _MM_MouseMoveOn: Moves the mouse pointer between multi monitors. ; _MM_ToolTipOn : Creates a tooltip anywhere on multi monitors ; _MM_GetPointPos: Translate the X, Y point, to given monitor X, Y. ; _MM_GetMonitorsArray: Return a 2D array containing the monitors informations ; ==================================================================================================================== ; #FUNCTION# ========================================================================================================= ; Name...........: _MM_WinBySide ; Description ...: Moves and/or resizes and arrange windows between multi monitors. ; Syntax.........: _MM_WinBySide ( $hWin1 [, $hWin2 = 0 [, $iView1 = 65 [, $sDevice = "Primary"]]]) ; Parameters ....: $hWin1 - The title/hWnd/class of the window1, ; $hWin2 - [optional] The title/hWnd/class of the window2. ; $iView1 - [optional] Percentage of the current @DesktopWidth, for window1. Negative value start from the right side ; $sDevice - [optional] The name of the device to move to, e.g. \\.\DISPLAY1 , \\.\DISPLAY2 , "Primary" is the primary monitor ; Return value...: None ; Author ........: ioa747 ; Notes .........: If $hWin2 = 0 then will be ignored, and act only to window1 ; ==================================================================================================================== Func _MM_WinBySide($hWin1, $hWin2 = 0, $iView1 = 65, $sDevice = "Primary") Local Enum $hM, $RX, $RY, $RW, $RH, $Dv, $Pr, $WX, $WY, $WW, $WH, $Sc Local $Cur Local $aMon = _MM_GetMonitorsArray() If IsArray($aMon) Then For $i = 1 To $aMon[0][0] If $sDevice = "Primary" Then If $aMon[$i][$Pr] = 1 Then $Cur = $i Else If $aMon[$i][$Dv] = $sDevice Then $Cur = $i EndIf Next Else Return SetError(1, @extended, 0) EndIf If Not $Cur Then Return SetError(2, @extended, 0) EndIf Local $iScale, $iwX, $iwY, $iwW, $iwH, $awPos $iScale = ($aMon[$Cur][$RW] / 100) ; = 1% ; Win1 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: If $iView1 > 0 Then $iwX = $aMon[$Cur][$WX] - (7 * $aMon[$Cur][$Sc]) $iwY = $aMon[$Cur][$WY] $iwW = ($iScale * $iView1) + (14 * $aMon[$Cur][$Sc]) $iwH = $aMon[$Cur][$WH] + (7 * $aMon[$Cur][$Sc]) Else $iwX = ($aMon[$Cur][$WW] - ($iScale * Abs($iView1))) - (7 * $aMon[$Cur][$Sc]) $iwY = $aMon[$Cur][$WY] $iwW = ($iScale * Abs($iView1)) + (14 * $aMon[$Cur][$Sc]) $iwH = $aMon[$Cur][$WH] + (7 * $aMon[$Cur][$Sc]) EndIf WinMove($hWin1, "", $iwX, $iwY, $iwW, $iwH) Sleep(200) $awPos = WinGetPos($hWin1) If $iwW <> $awPos[2] Then WinMove($hWin1, "", $iwX, $iwY, $iwW, $iwH) Sleep(200) $awPos = WinGetPos($hWin1) EndIf ; Win2 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: If $hWin2 Then If $iView1 > 0 Then $iwX = $aMon[$Cur][$WX] + ($iScale * $iView1) - (7 * $aMon[$Cur][$Sc]) $iwY = $aMon[$Cur][$WY] $iwW = $aMon[$Cur][$RW] + (14 * $aMon[$Cur][$Sc]) - ($iScale * $iView1) $iwH = $aMon[$Cur][$WH] + (7 * $aMon[$Cur][$Sc]) Else $iwX = $aMon[$Cur][$WX] - (7 * $aMon[$Cur][$Sc]) $iwY = $aMon[$Cur][$WY] $iwW = $aMon[$Cur][$RW] + (14 * $aMon[$Cur][$Sc]) - ($iScale * Abs($iView1)) $iwH = $aMon[$Cur][$WH] + (7 * $aMon[$Cur][$Sc]) EndIf WinMove($hWin2, "", $iwX, $iwY, $iwW, $iwH) Sleep(200) $awPos = WinGetPos($hWin2) If $iwW <> $awPos[2] Then WinMove($hWin2, "", $iwX, $iwY, $iwW, $iwH) Sleep(200) $awPos = WinGetPos($hWin2) EndIf EndIf ;give focus to $hWin2 WinActivate($hWin2) ;give focus to $hWin1 WinActivate($hWin1) EndFunc ;==>_MM_WinBySide ; #FUNCTION# ========================================================================================================= ; Name...........: _MM_WinMoveOn ; Description ...: Moves and/or resizes a window between multi monitors. ; Syntax.........: _MM_WinMoveOn ( $hWin, $iX, $iY, [$iWidth = Default [, $iHeigh = Default [, $iSpeed = -1 [, $sDevice = "Primary" [, $Scale = False]]]]] ) ; Parameters ....: $hWin - The title/hWnd/class of the window to move/resize. ; $iX - X coordinate to move to. ; $iY - Y coordinate to move to. ; $iWidth - [optional] New width of the window ; $iHeigh - [optional] New height of the window. ; $iSpeed - [optional] The speed to move the windows in the range 1 (fastest) to 100 (slowest). If not defined the move is instantaneous ; $sDevice - [optional] The name of the device to move to, e.g. \\.\DISPLAY1 , \\.\DISPLAY2 , "Primary" is the primary monitor ; $Scale - [optional] True/False. If True the dimensions will be multiplied with the scale factor ; Return value...: Success: a handle to the window. Failure: 0 if the window is not found. ; Author ........: ioa747 ; Notes .........: In $iX, $iY, $iWidth, $iHeigh parameters can use string expression with the variable $DtW = current @DesktopWidth , $DtH = current @DesktopHeight ; ==================================================================================================================== Func _MM_WinMoveOn($hWin, $iX, $iY, $iWidth = Default, $iHeigh = Default, $iSpeed = -1, $sDevice = "Primary", $Scale = False) Local Enum $hM, $RX, $RY, $RW, $RH, $Dv, $Pr, $WX, $WY, $WW, $WH, $Sc Local $Cur, $iScale, $iwX, $iwY, $iwW, $iwH, $awPos, $DtW, $DtH Local $aMon = _MM_GetMonitorsArray() If IsArray($aMon) Then For $i = 1 To $aMon[0][0] If $sDevice = "Primary" Then If $aMon[$i][$Pr] = 1 Then $Cur = $i Else If $aMon[$i][$Dv] = $sDevice Then $Cur = $i EndIf Next Else Return SetError(1, @extended, 0) EndIf If Not $Cur Then Return SetError(2, @extended, 0) EndIf $DtW = $aMon[$Cur][$RW] $DtH = $aMon[$Cur][$RH] If $Scale = False Then $iScale = 1 Else $iScale = $aMon[$Cur][$Sc] EndIf ; Win1 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: If WinExists($hWin) Then $awPos = WinGetPos($hWin) If VarGetType($iX) = "String" Then $iwX = $aMon[$Cur][$WX] + (Execute($iX) * $iScale) - (7 * $aMon[$Cur][$Sc]) Else $iwX = $aMon[$Cur][$WX] + ($iX * $iScale) - (7 * $aMon[$Cur][$Sc]) EndIf If VarGetType($iY) = "String" Then $iwY = $aMon[$Cur][$WY] + (Execute($iY) * $iScale) Else $iwY = $aMon[$Cur][$WY] + ($iY * $iScale) EndIf If $iWidth = Default Then $iwW = $awPos[2] * $iScale Else If VarGetType($iWidth) = "String" Then $iwW = (Execute($iWidth) * $iScale) + (14 * $aMon[$Cur][$Sc]) Else $iwW = ($iWidth * $iScale) + (14 * $aMon[$Cur][$Sc]) EndIf EndIf If $iHeigh = Default Then $iwH = $awPos[3] * $iScale Else If VarGetType($iHeigh) = "String" Then $iwH = (Execute($iHeigh) * $iScale) + (7 * $aMon[$Cur][$Sc]) Else $iwH = ($iHeigh * $iScale) + (7 * $aMon[$Cur][$Sc]) EndIf EndIf WinMove($hWin, "", $iwX, $iwY, $iwW, $iwH, $iSpeed) Sleep(200) $awPos = WinGetPos($hWin) If $iwW <> $awPos[2] Then WinMove($hWin, "", $iwX, $iwY, $iwW, $iwH) Sleep(200) $awPos = WinGetPos($hWin) EndIf ;give focus to $hWin WinActivate($hWin) Return $hWin Else Return SetError(3, @extended, 0) EndIf EndFunc ;==>_MM_WinMoveOn ; #FUNCTION# ========================================================================================================= ; Name...........: _MM_MouseMoveOn ; Description ...: Moves the mouse pointer between multi monitors. ; Syntax.........: _MM_MouseMoveOn ( $iX, $iY [, $iSpeed = 10 [, $sDevice = "Primary" [, $Scale = False]]] ) ; Parameters ....: $iX - X coordinate to move to. ; $iY - Y coordinate to move to. ; $iSpeed - [optional] The speed to move the windows in the range 0 (fastest) to 100 (slowest). ; $sDevice - [optional] The name of the device to move to, e.g. \\.\DISPLAY1 , \\.\DISPLAY2 , "Primary" is the primary monitor ; $Scale - [optional] True/False. If True the dimensions will be multiplied with the scale factor ; Return value...: None ; Author ........: ioa747 ; Notes .........: In $iX, $iY parameters can use string expression with the variable $DtW = current @DesktopWidth , $DtH = current @DesktopHeight ; ==================================================================================================================== Func _MM_MouseMoveOn($iX, $iY, $iSpeed = 10, $sDevice = "Primary", $Scale = False) Local Enum $hM, $RX, $RY, $RW, $RH, $Dv, $Pr, $WX, $WY, $WW, $WH, $Sc Local $Cur Local $aMon = _MM_GetMonitorsArray() If IsArray($aMon) Then For $i = 1 To $aMon[0][0] If $sDevice = "Primary" Then If $aMon[$i][$Pr] = 1 Then $Cur = $i Else If $aMon[$i][$Dv] = $sDevice Then $Cur = $i EndIf Next Else Return SetError(1, @extended, 0) EndIf If Not $Cur Then Return SetError(2, @extended, 0) EndIf Local $iScale, $iwX, $iwY, $amPos, $DtW, $DtH $DtW = $aMon[$Cur][$RW] $DtH = $aMon[$Cur][$RH] If $Scale = False Then $iScale = 1 Else $iScale = $aMon[$Cur][$Sc] EndIf $amPos = MouseGetPos() If VarGetType($iX) = "String" Then $iwX = $aMon[$Cur][$WX] + (Execute($iX) * $iScale) Else $iwX = $aMon[$Cur][$WX] + ($iX * $iScale) EndIf If VarGetType($iY) = "String" Then $iwY = $aMon[$Cur][$WY] + (Execute($iY) * $iScale) Else $iwY = $aMon[$Cur][$WY] + ($iY * $iScale) EndIf MouseMove($iwX, $iwY, $iSpeed) Sleep(200) $amPos = MouseGetPos() If $iwX <> $amPos[0] Then MouseMove($iwX, $iwY, $iSpeed) Sleep(200) $amPos = MouseGetPos() EndIf EndFunc ;==>_MM_MouseMoveOn ; #FUNCTION# ========================================================================================================= ; Name...........: _MM_ToolTipOn ; Description ...: Creates a tooltip anywhere on multi monitors ; Syntax.........: _MM_ToolTipOn($sText [, $iX = Default [, $iY = Default [, $sTitle = Default [, $iIcon = Default [, $iOptions = Default [, $sDevice = "Primary" [, $Scale = False]]]]]]]) ; Parameters ....: $sText The text of the tooltip. (An empty string clears a displaying tooltip) ; $iX - [optional] The x position of the tooltip. ; $iY - [optional] The y position of the tooltip. ; $sTitle - [optional] The title for the tooltip. ; $iIcon - [optional] Pre-defined icon to show next to the title: Requires a title. 0=NoIcon, 1=InfoIcon, 2=WarningIcon, 3=ErrorIcon ; $iOptions - [optional] Sets different options for how the tooltip will be displayed (Can be added together): ; 1=Display As BalloonTip 2= Center The Tip At The X,Y Coord 4=Force the tooltip to always be visible confining it to monitor borders if necessary. ; If multiple monitors are used, then the tooltip will "snap-to" the nearest monitor. ; $sDevice - [optional] The name of the device to move to, e.g. \\.\DISPLAY1 , \\.\DISPLAY2 , "Primary" is the primary monitor ; $Scale - [optional] True/False. If True the dimensions will be multiplied with the scale factor ; Return value...: None ; Author ........: ioa747 ; Notes .........: In $iX, $iY parameters can use string expression with the variable $DtW = current @DesktopWidth , $DtH = current @DesktopHeight ; ==================================================================================================================== Func _MM_ToolTipOn($sText, $iX = Default, $iY = Default, $sTitle = Default, $iIcon = Default, $iOptions = Default, $sDevice = "Primary", $Scale = False) ;~ ToolTip ( "text" [, x [, y [, "title" [, icon = 0 [, options]]]]] ) Local Enum $hM, $RX, $RY, $RW, $RH, $Dv, $Pr, $WX, $WY, $WW, $WH, $Sc Local $Cur Local $aMon = _MM_GetMonitorsArray() If IsArray($aMon) Then For $i = 1 To $aMon[0][0] If $sDevice = "Primary" Then If $aMon[$i][$Pr] = 1 Then $Cur = $i Else If $aMon[$i][$Dv] = $sDevice Then $Cur = $i EndIf Next Else Return SetError(1, @extended, 0) EndIf If Not $Cur Then Return SetError(2, @extended, 0) EndIf Local $iScale, $iwX, $iwY, $DtW, $DtH $DtW = $aMon[$Cur][$RW] $DtH = $aMon[$Cur][$RH] If $Scale = False Then $iScale = 1 Else $iScale = $aMon[$Cur][$Sc] EndIf If VarGetType($iX) = "String" Then $iwX = $aMon[$Cur][$WX] + (Execute($iX) * $iScale) Else $iwX = $aMon[$Cur][$WX] + ($iX * $iScale) EndIf If VarGetType($iY) = "String" Then $iwY = $aMon[$Cur][$WY] + (Execute($iY) * $iScale) Else $iwY = $aMon[$Cur][$WY] + ($iY * $iScale) EndIf ToolTip($sText, $iwX, $iwY, $sTitle, $iIcon, $iOptions) EndFunc ;==>_MM_ToolTipOn ; #FUNCTION# ========================================================================================================= ; Name...........: _MM_GetPointPos ; Description ...: Translate the X, Y point, to given monitor X, Y. ; Syntax.........: _MM_GetPointPos ( $iX, $iY [, $sDevice = "Primary" [, $Scale = False]] ) ; Parameters ....: $iX - X coordinate to Translate. ; $iY - Y coordinate to Translate. ; $sDevice - [optional] The name of the device to move to, e.g. \\.\DISPLAY1 , \\.\DISPLAY2 , "Primary" is the primary monitor ; $Scale - [optional] True/False. If True the dimensions will be multiplied with the scale factor ; Return value...: a two-element array containing the X, Y coordinates: $aArray[0] = X coord (horizontal), $aArray[1] = Y coord (vertical) ; Author ........: ioa747 ; Notes .........: In $iX, $iY parameters can use string expression with the variable $DtW = current @DesktopWidth , $DtH = current @DesktopHeight ; ==================================================================================================================== Func _MM_GetPointPos($iX, $iY, $sDevice = "Primary", $Scale = False) Local Enum $hM, $RX, $RY, $RW, $RH, $Dv, $Pr, $WX, $WY, $WW, $WH, $Sc Local $Cur Local $aMon = _MM_GetMonitorsArray() If IsArray($aMon) Then For $i = 1 To $aMon[0][0] If $sDevice = "Primary" Then If $aMon[$i][$Pr] = 1 Then $Cur = $i Else If $aMon[$i][$Dv] = $sDevice Then $Cur = $i EndIf Next Else Return SetError(1, @extended, 0) EndIf If Not $Cur Then Return SetError(2, @extended, 0) EndIf Local $iScale, $iwX, $iwY, $apPos[2], $DtW, $DtH $DtW = $aMon[$Cur][$RW] $DtH = $aMon[$Cur][$RH] If $Scale = False Then $iScale = 1 Else $iScale = $aMon[$Cur][$Sc] EndIf If VarGetType($iX) = "String" Then $iwX = $aMon[$Cur][$WX] + (Execute($iX) * $iScale) Else $iwX = $aMon[$Cur][$WX] + ($iX * $iScale) EndIf If VarGetType($iY) = "String" Then $iwY = $aMon[$Cur][$WY] + (Execute($iY) * $iScale) Else $iwY = $aMon[$Cur][$WY] + ($iY * $iScale) EndIf $apPos[0] = $iwX $apPos[1] = $iwY Return $apPos EndFunc ;==>_MM_GetPointPos ; #FUNCTION# ========================================================================================================= ; Name...........: _MM_GetMonitorsArray ; Description ...: Return a 2D array containing the monitors informations ; Syntax ........: _MM_GetMonitorsArray() ; Parameters ....: None ; Return values .: Return a 2D array containing the monitors informations ; Author ........: ioa747 ; Modified.......: ; Remarks .......: Help if use Local Enum $hM, $RX, $RY, $RW, $RH, $Dv, $Pr, $WX, $WY, $WW, $WH, $Sc ; 0=hM, 1=RX, 2=RY, 3=RW, 4=RH, 5=Dv, 6=Pr, 7=WX, 8=WY, 9=WW, 10=WH, 11=Sc ; ==================================================================================================================== Func _MM_GetMonitorsArray() ;0=hM, 1=RX, 2=RY, 3=RW, 4=RH, 5=Dv, 6=Pr, 7=WX, 8=WY, 9=WW, 10=WH, 11=Sc ;Local Enum $hM, $RX, $RY, $RW, $RH, $Dv, $Pr, $WX, $WY, $WW, $WH, $Sc Local $aPos, $aMonitorInfo, $aData = _WinAPI_EnumDisplayMonitors() If IsArray($aData) Then ReDim $aData[$aData[0][0] + 1][12] 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 $aMonitorInfo = _WinAPI_GetMonitorInfo($aData[$i][0]) $aData[$i][5] = $aMonitorInfo[3] ;Device name $aData[$i][6] = $aMonitorInfo[2] ;Primary $aData[$i][7] = DllStructGetData($aMonitorInfo[1], 1) ;wx $aData[$i][8] = DllStructGetData($aMonitorInfo[1], 2) ;wy $aData[$i][9] = DllStructGetData($aMonitorInfo[1], 3) ;ww $aData[$i][10] = DllStructGetData($aMonitorInfo[1], 4) ;wh $aData[$i][11] = _WinAPI_EnumDisplaySettings($aMonitorInfo[3], $ENUM_CURRENT_SETTINGS)[0] / @DesktopWidth Next EndIf ;_ArrayDisplay($aData, "", "", 0, Default, "0=hM|1=RX|2=RY|3=RW|4=RH|5=Dv|6=Pr|7=WX|8=WY|9=WW|10=WH|11=Sc") Return $aData EndFunc ;==>_MM_GetMonitorsArray Tested on Windows 10 Version 22H2 main setting Here I should emphasize, in my example I use \\.\DISPLAY1 as primary and \\.\DISPLAY2 as extended monitor on your system this may not work and need to be adjusted Example.au3 ; https://www.autoitscript.com/forum/topic/210826-moves-andor-resizes-and-arrange-windows-between-multi-monitors ;---------------------------------------------------------------------------------------- ; Title...........: Example.au3 ; Description.....: Example for UDF "MultiMonitors.au3" ; AutoIt Version..: 3.3.16.1 Author: ioa747 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 6 -w 7 #include "MultiMonitors.au3" #include <Misc.au3> Global $hDLL = DllOpen("user32.dll") ; for the _IsPressed ; first make 2 Test File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Global $sFile_1 = @ScriptDir & '\MoveOnMultiMonitors_Test_1.txt' Global $sFile_2 = @ScriptDir & '\MoveOnMultiMonitors_Test_2.txt' If Not FileExists($sFile_1) Then FileWriteLine($sFile_1, "Win_1") If Not FileExists($sFile_2) Then FileWriteLine($sFile_2, "Win_2") ; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _Example_WinBySide() ; _MM_WinBySide: Moves and/or resizes and arrange windows between multi monitors. _Example_WinMoveOn() ; _MM_WinMoveOn: Moves and/or resizes a window between multi monitors. _Example() ; _MM_GetPointPos & _MM_GetPointPos ; Delete the 2 Test File ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If FileExists($sFile_1) Then FileDelete($sFile_1) If FileExists($sFile_2) Then FileDelete($sFile_2) DllClose($hDLL) Exit ;---------------------------------------------------------------------------------------- Func _Example_WinBySide() ; _MM_WinBySide: Moves and/or resizes and arrange windows between multi monitors. Local $Tip, $Title Local $Sign = @CRLF & @CRLF & "press {CTRL} to continue to the next - press {ESC} to Exit" $Tip = "Start " $Title = "Moves and/or resizes and arrange windows between multi monitors" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _Wait(2) Local $hWin_1 = WinWait("MoveOnMultiMonitors_Test_1.txt - Notepad", "", 1) If Not WinExists($hWin_1) Then ShellExecute("notepad.exe", $sFile_1) $hWin_1 = WinWait("MoveOnMultiMonitors_Test_1.txt - Notepad") ConsoleWrite("- $hWin_1=" & $hWin_1 & @CRLF) Local $hWin_2 = WinWait("MoveOnMultiMonitors_Test_2.txt - Notepad", "", 1) If Not WinExists($hWin_2) Then ShellExecute("notepad.exe", $sFile_2) $hWin_2 = WinWait("MoveOnMultiMonitors_Test_2.txt - Notepad") ConsoleWrite("- $hWin_2=" & $hWin_2 & @CRLF) ; 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = " Win_1 30% on the left side on Primary monitor" $Title = "1) _MM_WinBySide()" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _MM_WinBySide($hWin_1, $hWin_2, 30) _Wait() ; 2) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = " Win_1 70% on the left side on DISPLAY2" $Title = "2) _MM_WinBySide()" & $Sign _MM_ToolTipOn($Title, "($DtW / 2)", "($DtH / 2)", $Tip, 1, Default, "\\.\DISPLAY2") _MM_WinBySide($hWin_1, $hWin_2, 70, "\\.\DISPLAY2") _Wait() ; 3) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = " Win_1 70% on the right side on Primary monitor" $Title = "3) _MM_WinBySide()" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _MM_WinBySide($hWin_1, $hWin_2, -70) _Wait() WinClose($hWin_2) ; now we have 1 windows to handle $hWin_1 ~~~~~~~~~~ ; 4) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = " Win_1 alone 70% on the left side on Primary monitor" $Title = "4) _MM_WinBySide() - Win_1 alone" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _MM_WinBySide($hWin_1, 0, 70) _Wait() ; 5) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = " Win_1 alone 70% on the right side on Primary monitor" $Title = "5) _MM_WinBySide() - Win_1 alone" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _MM_WinBySide($hWin_1, 0, -70) _Wait() WinClose($hWin_1) EndFunc ;==>_Example_WinBySide ;---------------------------------------------------------------------------------------- Func _Example_WinMoveOn() ; _MM_WinMoveOn: Moves and/or resizes a window between multi monitors. Local $Tip, $Title Local $Sign = @CRLF & @CRLF & "press {CTRL} to continue to the next - press {ESC} to Exit" $Tip = "Start " $Title = "Moves and/or resizes a window between multi monitors." & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _Wait(2) Local $hWin_1 = WinWait("MoveOnMultiMonitors_Test_1.txt - Notepad", "", 1) If Not WinExists($hWin_1) Then ShellExecute("notepad.exe", $sFile_1) $hWin_1 = WinWait("MoveOnMultiMonitors_Test_1.txt - Notepad") ConsoleWrite("- $hWin_1=" & $hWin_1 & @CRLF) ; 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = " ($hWin_1, 0, 0, 600, 300, -1, '\\.\DISPLAY1')" $Title = "1) _MM_WinMoveOn" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _MM_WinMoveOn($hWin_1, 0, 0, 600, 300, -1, "\\.\DISPLAY1") _Wait() ; 2) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = " ($hWin_1, 0, 300, Default, Default, -1, '\\.\DISPLAY1')" $Title = "2) _MM_WinMoveOn" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _MM_WinMoveOn($hWin_1, 0, 300, Default, Default, -1, "\\.\DISPLAY1") _Wait() ; 3) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = " ($hWin_1, 0, 0, 600, 300, -1, '\\.\DISPLAY2', False)" $Title = "3) _MM_WinMoveOn" & $Sign _MM_ToolTipOn($Title, "($DtW / 2)", "($DtH / 2)", $Tip, 1, Default, "\\.\DISPLAY2") _MM_WinMoveOn($hWin_1, 0, 0, 600, 300, -1, "\\.\DISPLAY2", False) _Wait() ; 4) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = " ($hWin_1, 0, 0, 600, 300, -1, '\\.\DISPLAY2', True)" $Title = "4) _MM_WinMoveOn" & $Sign _MM_ToolTipOn($Title, "($DtW / 2)", "($DtH / 2)", $Tip, 1, Default, "\\.\DISPLAY2") _MM_WinMoveOn($hWin_1, 0, 0, 600, 300, -1, "\\.\DISPLAY2", True) _Wait() ; now we have 1 windows to handle with Special parameters ~~~~~~~~~~~ ; In $iX, $iY, $iWidth, $iHeigh parameters can use string expression with the variable $DtW = current @DesktopWidth , $DtH = current @DesktopHeight ; 5) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = '($hWin_1, "($DtW / 2) - 300", "($DtH / 2) - 150", 600, 300)' $Title = "5) _MM_WinMoveOn() - Special parameters" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _MM_WinMoveOn($hWin_1, "($DtW / 2) - 300", "($DtH / 2) - 150", 600, 300) _Wait() ; 6) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = '($hWin_1, "($DtW/2) - ($DtW/4)", "($DtH/2) - ($DtH/4)", "($DtW/2)", "($DtH/2)", -1, "\\.\DISPLAY2")' $Title = "6) _MM_WinMoveOn() - Special parameters" & $Sign _MM_ToolTipOn($Title, "($DtW / 2)", "($DtH / 2)", $Tip, 1, Default, "\\.\DISPLAY2") _MM_WinMoveOn($hWin_1, "($DtW / 2) - ($DtW / 4)", "($DtH / 2) - ($DtH / 4)", "($DtW / 2)", "($DtH / 2)", -1, "\\.\DISPLAY2") _Wait() ; 7) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = '($hWin_1, "$DtW / 3", "$DtH / 5", "$DtW / 2", "$DtH / 2")' $Title = "7) _MM_WinMoveOn() - Special parameters" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1) _MM_WinMoveOn($hWin_1, "$DtW / 3", "$DtH / 5", "$DtW / 2", "$DtH / 2") _Wait() ToolTip("") WinClose($hWin_1) EndFunc ;==>_Example_WinMoveOn ;---------------------------------------------------------------------------------------- Func _Example() ; _MM_GetPointPos & _MM_GetPointPos ; _MM_MouseMoveOn: Moves the mouse pointer between multi monitors. ; _MM_GetPointPos: Translate the X, Y point, to given monitor X, Y. Local $Tip, $Title Local $Sign = @CRLF & @CRLF & "press {CTRL} to continue to the next - press {ESC} to Exit" Local $iMidW = @DesktopWidth / 2, $iMidH = @DesktopHeight / 2 ; 1) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; move the mouse ponter to Desktop center $Tip = "Mouse x, y:" & @CRLF & $iMidW & ", " & $iMidH $Title = "1) midle point:" & $Sign ToolTip($Title, $iMidW, $iMidH, $Tip, 1, 3) MouseMove($iMidW, $iMidH) _Wait(2) ; 2) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; move the mouse ponter to center of DISPLAY2 with _MM_GetPointPos ; _MM_GetPointPos ( $iX, $iY [, $sDevice = "Primary" [, $Scale = False]] ) Local $aPos = _MM_GetPointPos("($DtW / 2)", "($DtH / 2)", "\\.\DISPLAY2") $Tip = "Mouse x, y:" & @CRLF & $aPos[0] & ", " & $aPos[1] $Title = "2) midle point:" & $Sign ToolTip($Title, $aPos[0], $aPos[1], $Tip, 1, 3) MouseMove($aPos[0], $aPos[1], 30) ; move the mouse ponter to 100, @DesktopHeight / 2 of DISPLAY2 with _MM_MouseMoveOn ; _MM_MouseMoveOn ( $iX, $iY [, $iSpeed = 10 [, $sDevice = "Primary" [, $Scale = False]]] ) _MM_MouseMoveOn(100, "($DtH / 2)", 30, "\\.\DISPLAY2") ; move the mouse ponter to center of DISPLAY2 with _MM_MouseMoveOn _MM_MouseMoveOn("($DtW / 2)", "($DtH / 2)", 30, "\\.\DISPLAY2") _Wait(2) ; 3) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; now let's see the $Scale parameter ; $Scale - [optional] True/False. Default = False ; If True the dimensions will be multiplied with the scale factor of curent monitor $Tip = " move mouse point back" $Title = "3) now let's see the $Scale parameter" & $Sign ToolTip($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1, 3) MouseMove($iMidW, $iMidH) _Wait() ; 4) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; $Scale = False $Tip = ' (1000, 1000, Default, "\\.\DISPLAY2", False )' $Title = "4) _MM_MouseMoveOn() - $Scale = False" & $Sign ; ToolTip($Tip, 1000, 1000, "_MM_MouseMoveOn() - $Scale = False", 1, 3) ; ordinary ToolTip _MM_ToolTipOn($Title, 1000, 1000, $Tip, 1, 3, "\\.\DISPLAY2", False) _MM_MouseMoveOn(1000, 1000, 10, "\\.\DISPLAY2", False) _Wait() ; 5) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; $Scale = True $Tip = ' (1000, 1000, Default, "\\.\DISPLAY2", True)' $Title = "5) _MM_MouseMoveOn() - $Scale = True" & $Sign ; ToolTip($Tip, 1000, 1000, "_MM_MouseMoveOn() - $Scale = False", 1, 3) ; ordinary ToolTip _MM_ToolTipOn($Title, 1000, 1000, $Tip, 1, 3, "\\.\DISPLAY2", True) _MM_MouseMoveOn(1000, 1000, 10, "\\.\DISPLAY2", True) _Wait() ; 6) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; which means that with the scale factor, we can use proportional dimensions with respect to the primary display $Tip = ' _MM_MouseMoveOn() - $Scale = True' $Title = "6) which means that with the scale factor," & @CRLF $Title &= "we can use proportional dimensions with respect to the primary display" & $Sign _MM_ToolTipOn($Title, @DesktopWidth / 2, @DesktopHeight / 2, $Tip, 1, -1, "\\.\DISPLAY2", True) _MM_MouseMoveOn(10, 10, 10, "\\.\DISPLAY2", True) _MM_MouseMoveOn(@DesktopWidth - 10, 10, 10, "\\.\DISPLAY2", True) _MM_MouseMoveOn(@DesktopWidth - 10, 10, 10, "\\.\DISPLAY2", True) _MM_MouseMoveOn(@DesktopWidth - 10, @DesktopHeight - 10, 10, "\\.\DISPLAY2", True) _MM_MouseMoveOn(10, @DesktopHeight - 10, 10, "\\.\DISPLAY2", True) _MM_MouseMoveOn(10, 10, 30, "\\.\DISPLAY2", True) ; 7) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $Tip = '=== _MM_ToolTipOn with $Scale False ===' $Title = "5) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & $Sign _MM_ToolTipOn($Tip, "$DtW/2", "$DtH/2", "$Scale = False", 1, 3, "\\.\DISPLAY2", False) _Wait() $Tip = '=== _MM_ToolTipOn with $Scale True ===' $Title = "5) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & $Sign _MM_ToolTipOn($Tip, @DesktopWidth / 2, @DesktopHeight / 2, "$Scale = True", 1, 3, "\\.\DISPLAY2", True) _Wait() ; 8) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ConsoleWrite(@CRLF & "8) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" & @CRLF) ; _MM_GetPointPos ( $iX, $iY [, $sDevice = "Primary" [, $Scale = False]] ) $aPos = _MM_GetPointPos(@DesktopWidth, @DesktopHeight, "\\.\DISPLAY2", False) ConsoleWrite("DISPLAY2 with false:" & $aPos[0] & "," & $aPos[1] & @CRLF) $aPos = _MM_GetPointPos(@DesktopWidth, @DesktopHeight, "\\.\DISPLAY2", True) ConsoleWrite(" DISPLAY2 with True:" & $aPos[0] & "," & $aPos[1] & @CRLF) EndFunc ;==>_Example ;---------------------------------------------------------------------------------------- Func _Wait($iSec = 5) ; 5*1000 = 5000 Local $iTmp, $Max = ($iSec * 1000) / 50 While Sleep(50) Select Case _IsPressed("11", $hDLL) ;11 CTRL key Sleep(50) Return Case _IsPressed("1B", $hDLL) ;1B = ESC key Exit EndSelect $iTmp += 1 If $iTmp = $Max Then Return WEnd EndFunc ;==>_Wait ;---------------------------------------------------------------------------------------- Please, every comment is appreciated! leave your comments and experiences here! Thank you very much
    1 point
  9. AGsol, You need to look for the $LVN_COLUMNCLICK code within the WM_NOTIFY message. Add: GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")after the GUISetState(@SW_SHOW) line and then use this handler function: Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Switch HWnd(DllStructGetData($tNMHDR, "hWndFrom")) Case $ListView1_Handle Switch DllStructGetData($tNMHDR, "Code") Case $LVN_COLUMNCLICK ; A column was clicked Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam) Local $iCol = DllStructGetData($tInfo, "SubItem") ConsoleWrite("Column clicked: " & $iCol & @CRLF) EndSwitch EndSwitch Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFYIf you are unsure about GUIRegisterMsg and Windows message handlers, I recommend the GUIRegisterMsg tutorial in the Wiki. Please ask if you have any questions. M23
    1 point
×
×
  • Create New...