Custom Query (3931 matches)
Results (196 - 198 of 3931)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #197 | Rejected | $CmdLine as @CmdLine | ||
| Description |
I propose that $CmdLine may be changed to a macro to reduce confusion. I saw a thread where a user attempted to assign to the variable $cmdline and got an error. By changing the symbol to the @ macro style, it would alleviate any ideas of ever reassigning it. For reference, the post was found here. http://www.autoitscript.com/forum/index.php?showtopic=67588 |
|||
| #198 | Fixed | _FileReadToArray | ||
| Description |
Hi, this is no really big bug, but it would be nice if someone could explain that to me. In the function _FileReadToArray there is this code $aArray = StringSplit(StringStripCR(StringStripWS(FileRead($hFile, FileGetSize($sFilePath)), 2)), @LF) This cuts off emtpy lines at the end of the file. Is this correct? Why not putting empty lines to the array? Thanks for clarification. Mega |
|||
| #199 | Rejected | Multi-Monitor Support Include File | ||
| Description |
I have taken several scripts from the AutoIt form and created a WORKING include file to gather and return metrics for all active display devices on a PC. This works for 2+ monitors & returns AutoIt friendly data including Left,Top,Width,Height. It works on XP (still needs to be tested on Vista sorry). If you have any questions or would like to see the Flash screen saver I created for 30,000+ workstations please email me thomas at caplan77 dot com. ;Include PreDefined Functions
#include-once
#include <GuiConstantsEx.au3>
#include <GUIConstants.au3>
; #INDEX# =======================================================================================================================
; Title .........: _AllMonitorMetrics
; Description ...: Determines the number of active displays and returns RECT plus AutoIt friendly width & height for each (up to 31 displays).
; Author ........: Thomas W Caplan and the AutoIt Form
; ===============================================================================================================================
; #CONSTANTS# ===================================================================================================================
Global Const $DISPLAY_DEVICE_ACTIVE = 0x00000001
Global Const $DISPLAY_DEVICE_ATTACHED = 0x00000002
Global Const $ENUM_CURRENT_SETTINGS = -1
Global Const $ENUM_REGISTRY_SETTINGS = -2
Global Const $MONITORINFO = "int;int[4];int[4];int"
Global Const $RECT = "long;long;long;long"
Global Const $DEVMODE = "byte[32];short;short;short;short;int;int[2];int;int;short;short;short;short;short;byte[32];short;ushort;int;int;int;int"
Global Const $POINTL = "long;long"
Global Const $DISPLAY_DEVICE = "int;char[32];char[128];int;char[128];char[128]"
; ===============================================================================================================================
; ===============================================================================================================================
; #CURRENT# =====================================================================================================================
;_AllMonitorMetrics
; ===============================================================================================================================
; #FUNCTION# ====================================================================================================================
; Name...........: _AllMonitorMetrics
; Description ...: Determines the number of active displays and returns RECT plus AutoIt friendly width & height for each (up to 31 displays).
; Syntax.........: _AllMonitorMetrics()
; Parameters ....: None
; Return values .: Success - Returns an array with the following:
; - [0][0] = Total Number of Monitors.
; - [Monitor#][0] = Display Handle
; - [Monitor#][1] = Left-Most Coordinate
; - [Monitor#][2] = Top-Most Coordinate
; - [Monitor#][3] = Right-Most Coordinate
; - [Monitor#][4] = Bottom-Most Coordinate
; - [Monitor#][5] = Display Width
; - [Monitor#][6] = Display Height
; Author ........: Thomas W Caplan and the AutoIt Form
; Modified.......:
; Remarks .......: Used on computers with 2+ displays. Coordinates are relative to monitor 1.
; Related .......:
; Link ..........; @@MsdnLink@@ EnumDisplayDevices
; @@MsdnLink@@ EnumDisplaySettingsEx
; @@MsdnLink@@ MonitorFromPoint
; @@MsdnLink@@ GetMonitorInfo
;
; Example .......; $displays = _AllMonitorMetrics()
; sgBox(0,Default,"Total Number of Displays: " & $displays[0][0])
; For $i = 1 To $displays[0][0]
; MsgBox(0,"Display "& $i,"HWnd: "& $displays[$i][0] &@LF&" Left: "& $displays[$i][1] &@LF _
; &" Top: "& $displays[$i][2] &@LF&" Right: "& $displays[$i][3] &@LF _
; &" Bottom: "& $displays[$i][4] &@LF&" Width: "& $displays[$i][5] &@LF&" Height: "& $displays[$i][6])
; Next
; ===============================================================================================================================
Func _AllMonitorMetrics()
Local $intDeviceNumber, $intDeviceID
Local $CurrentMonitorHWnd
Local $user32dll, $StateFlag
Local $EnumDisplaysEx, $EnumDisplays
Local $structDeviceMode, $structDisplayDevice, $structMonitorInfo
Local $xw,$xl,$yh,$yt,$yb,$xr
Local $AllMonitorMetrics[32][8]
$intDeviceNumber = 0
$intDeviceID = 0
$user32dll = DllOpen("user32.dll")
Dim $structDisplayDevice = DllStructCreate($DISPLAY_DEVICE)
DllStructSetData($structDisplayDevice, 1, DllStructGetSize($structDisplayDevice))
$EnumDisplays = DllCall($user32dll, "int", "EnumDisplayDevices", "ptr", 0, "int", $intDeviceNumber, "ptr", DllStructGetPtr($structDisplayDevice), "int", 0)
$StateFlag = Number(StringMid(Hex(DllStructGetData($structDisplayDevice, 4)), 3))
While $EnumDisplays[0] <> 0
If ($StateFlag <> $DISPLAY_DEVICE_MIRRORING_DRIVER) And ($StateFlag <> 0) Then ;Ignore virtual mirror displays.
;Get information about the display's position and the current display mode.
Dim $structDeviceMode = DllStructCreate($DEVMODE)
DllStructSetData($structDeviceMode, 4, DllStructGetSize($structDeviceMode))
$EnumDisplaysEx = DllCall($user32dll, "int", "EnumDisplaySettingsEx", "str", DllStructGetData($structDisplayDevice, 2), "int", $ENUM_CURRENT_SETTINGS, "ptr", DllStructGetPtr($structDeviceMode), "int", 0)
If $EnumDisplaysEx[0] = 0 Then
DllCall($user32dll, "int", "EnumDisplaySettingsEx", "str", DllStructGetData($structDisplayDevice, 2), "int", $ENUM_REGISTRY_SETTINGS, "ptr", DllStructGetPtr($structDeviceMode), "int", 0)
EndIf
;Get the monitor handle and workspace
Dim $CurrentMonitorHWnd
Dim $structMonitorInfo = DllStructCreate($MONITORINFO)
DllStructSetData($structMonitorInfo, 1, DllStructGetSize($structMonitorInfo))
If Mod($StateFlag, 2) <> 0 Then ;$DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
;Display is enabled. Only enabled displays have a monitor handle.
$CurrentMonitorHWnd = DllCall($user32dll, "hwnd", "MonitorFromPoint", "int", DllStructGetData($structDeviceMode, 7, 1), "int", DllStructGetData($structDeviceMode, 7, 2), "int", 0)
If $CurrentMonitorHWnd[0] <> 0 Then
DllCall($user32dll, "int", "GetMonitorInfo", "hwnd", $CurrentMonitorHWnd[0], "ptr", DllStructGetPtr($structMonitorInfo))
EndIf
EndIf
;Format RECT information about this monitor.
If $CurrentMonitorHWnd[0] <> 0 Then
$intDeviceID += 1
$AllMonitorMetrics[$intDeviceID][0] = $CurrentMonitorHWnd[0]
$AllMonitorMetrics[$intDeviceID][1] = DllStructGetData($structMonitorInfo, 2, 1) ;X-Coord Left Bound
$AllMonitorMetrics[$intDeviceID][2] = DllStructGetData($structMonitorInfo, 2, 2) ;Y-Coord Top Bound
$AllMonitorMetrics[$intDeviceID][3] = DllStructGetData($structMonitorInfo, 2, 3) ;X-Coord Right Bound
$AllMonitorMetrics[$intDeviceID][4] = DllStructGetData($structMonitorInfo, 2, 4) ;Y-Coord Bottom Bound
$xl = DllStructGetData($structMonitorInfo, 2, 1) ;X-Coord Left Bound
$yt = DllStructGetData($structMonitorInfo, 2, 2) ;Y-Coord Top Bound
$xr = DllStructGetData($structMonitorInfo, 2, 3) ;X-Coord Right Bound
$yb = DllStructGetData($structMonitorInfo, 2, 4) ;Y-Coord Bottom Bound
;Now converting RECT data into AutoIt friendly metrics: Width, Height.
;This is tricky since this display's RECT data is positive and/or negative in relation to the main monitor.
If $xl < 0 Then ;Left of Main Point 0,0.
If $xr < 0 Then
$xw = Abs(Abs($xl) - Abs($xr))
$AllMonitorMetrics[$intDeviceID][5] = $xw
Else
$xw = Abs($xl) + Abs($xr)
$AllMonitorMetrics[$intDeviceID][5] = $xw
EndIf
Else
$xw = Abs(Abs($xl) - Abs($xr))
$AllMonitorMetrics[$intDeviceID][5] = $xw
EndIf
If $yt < 0 Then ;Above Main Point 0,0.
If $yb < 0 Then
$yh = Abs(Abs($yt) - Abs($yb))
$AllMonitorMetrics[$intDeviceID][6] = $yh
Else
$yh = Abs($yt) + Abs($yb)
$AllMonitorMetrics[$intDeviceID][6] = $yh
EndIf
Else
$yh = Abs(Abs($yt) - Abs($yb))
$AllMonitorMetrics[$intDeviceID][6] = $yh
EndIf
EndIf
EndIf
$intDeviceNumber += 1
$EnumDisplays = DllCall($user32dll, "int", "EnumDisplayDevices", "ptr", 0, "int", $intDeviceNumber, "ptr", DllStructGetPtr($structDisplayDevice), "int", 0)
$StateFlag = Number(StringMid(Hex(DllStructGetData($structDisplayDevice, 4)), 3))
WEnd
DllClose($user32dll)
;Recording the total number of monitors.
$AllMonitorMetrics[0][0] = $intDeviceID
Return $AllMonitorMetrics
EndFunc ;==>_WinAPI_AllMonitorMetrics
|
|||
