Jump to content

Open Sumatra PDF on multiple screens


Mbachi
 Share

Recommended Posts

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)

 

Link to comment
Share on other sites

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:

Edited by Leendert-Jan
Ugh, spelling
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...