スクリプトの初期化では、画面の解像度を読み取る必要があるため、ブラウザのウィンドウサイズのサイズを変更する方法を知っています。
何か案は?
前もって感謝します!
プライマリモニターまたはすべてのマルチモニターの解像度を取得できるコードを次に示します。さらに、最後の関数は、複数のモニターがあるかどうかのブール値を返します。
'*******************************************************************
'TotalScreenWidth & TotalScreenHeight
'by Michael Innes
'October 2012
'Intended for getting the total resolution when you have multiple monitors
'Returns the width and the height (respectively) across all the screens.
Function TotalScreenWidth()
TotalScreenWidth = Window("regexpwndtitle:=Program Manager").GetROProperty("width")
End Function
Function TotalScreenHeight()
TotalScreenHeight = Window("regexpwndtitle:=Program Manager").GetROProperty("height")
End Function
'*******************************************************************
'ScreenWidth & ScreenHeight
'by Michael Innes
'October 2012
'Retrieves the width and height (respectively) of the primary screen (the screen that the taskbar is on)
'This only works if the taskbar is at the bottom of the screen
Function ScreenWidth()
ScreenWidth = Window("object class:=Shell_TrayWnd").GetROProperty("width")
End Function
Function ScreenHeight()
ScreenHeight = Window("object class:=Shell_TrayWnd").GetROProperty("height") + Window("object class:=Shell_TrayWnd").GetROProperty("y")
End Function
'*******************************************************************
'MultipleMonitors
'by Michael Innes
'October 2012
'Returns a boolean that determines if the computer has multiple monitors attached.
'This only works if the taskbar is at the bottom of the left-most screen.
'If the taskbar is on the right-most monitor, this function will incorrectly report the multiple monitors as being False.
Function MultipleMonitors()
MultipleMonitors = Eval((screenWidth <> TotalScreenWidth) OR (screenHeight <> TotalScreenHeight))
End Function
これは実際には非常に簡単です。デスクトップウィンドウを見つけて、そのサイズを取得します。
width = Window("text:=Program Manager").GetROProperty("width")
height = Window("text:=Program Manager").GetROProperty("height")
Print width & ", " & height
これは単一のモニターで機能します。複数のモニターがある場合に何が起こるかは確認していません。