Mbachi Posted October 11, 2021 Posted October 11, 2021 I have a need to get SumatraPDF to open PDF files and then move the files to different monitors. I need help getting the list of monitors and then help with the WinMove. When I run the simple code below, it doesn't move the program at all. I am a newcomer to AutoIT so this isn't something I know much about. Please can someone assist me with creating a script that identifies monitors and allows me to move the program to each screen. I have seven screens in total attached to my VM which I want to send a different PDF file to. ShellExecute ( "G:\General\Wallboards\OTC.exe", "OTC.pdf") $sPDFFile = "otc.pdf" WinMove($sPDFFile,"", 3940, 100) WinSetState("[TITLE:OTC.PDF]", "", @SW_MAXIMIZE)
Leendert-Jan Posted October 12, 2021 Posted October 12, 2021 (edited) Take look at the _WinAPI_EnumDisplayMonitors, it can determine how many monitors you have. Then use _WinAPI_GetPosFromRect() to show their resolutions. Example: #include <Array.au3> #include <WinAPIGdi.au3> ; Get the monitors Local $aMonitors = _WinAPI_EnumDisplayMonitors() ; For each monitor. For $i = 1 To $aMonitors[0][0] ; Get the resolution. $aPos = _WinAPI_GetPosFromRect($aMonitors[$i][1]) ; Display the info ConsoleWrite("Monitor " & $i & " = " & $aPos[2] & "x" & $aPos[3] & @CRLF) Next I have 3 monitors. For me the output is this: Monitor 1 = 1920x1080 Monitor 2 = 1920x1080 Monitor 3 = 1920x1080 More info: https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_EnumDisplayMonitors.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_GetPosFromRect.htm Edited October 12, 2021 by Leendert-Jan Ugh, spelling
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now