Sign in to follow this  
Followers 0
PartyPooper

Making GUI's open on a particular monitor

11 posts in this topic

I had a quick search in the forums and checked out the Windows Management section of the Help file but I haven't found anything that will allow me to force a GUI to open on the Primary (or Secondary) monitor for those systems that run two or more monitors. Can anyone point me in the right direction or isn't AutoIt able to do this (yet)?

Share this post


Link to post
Share on other sites



Bump

Anyone have any ideas yet?

Share this post


Link to post
Share on other sites

From the lack of responses, I'll assume AutoIt can't do it yet. Can any Devs give me an indication as to whether or not something like this will be included in a future release?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

PartyPooper,

I'm not quite sure what you're looking for in the way of AutoIt support. There are WMI scripts on the forum that enable you to get the coordinates of all the monitors on your system. Your application could then open any of it's windows on any of the monitors simply by using the correct coordinates. I run multiple monitors and I have Windows set to extend the desktop to the second monitor. The first monitor's x position is 0, the second monitor's x position is 1281 (the first monitor's resolutin is 720 by 1280) and the second monitor is position to the left of the first (you tell Windows). It's been a while since I've looked at this to recall what the configuration looks like if the desktop is not extended. Of course, a simplistic way around it is to simply use the Nvidia graphics driver which allows you to define profiles for application, including what monitor an application's windows should open on (everyone one uses Nvidia, right?) or a package like UltraMon.

If I create a window using GUICREATE (400, 400, 1281, 0) it opens in the upper-left corner of the second monitor.

Do these comments help at all?

Sincerely,

Paul

Edited by pdaughe

Share this post


Link to post
Share on other sites

2 monitors connected to the same machine? I think all you have to do is put it further on the x or y axis, depending on how the monitors are placed.

for example:

GUICreate(@desktopwidth + 50, 50, 500, 500)

would make it appear on the second monitor if the 2 monitors were placed next to each other.

P.S. that would only work if @desktopwidth returns the width of one of the monitors, and not both (im not sure), so you could use @desktopwidth/2 if it returns the width of both.


What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites

I run multiple (two) desktops with desktop spanning turned off (using the nVidia software). I tried the profiles and they work for AutoIt written apps, but not all apps, so I wanted to write an AutoIt one to force those apps that didn't work to open on a particular monitor. I might try desktop spanning to see if I get better results, In any case, you've given me an idea and a start - thanks.

Share this post


Link to post
Share on other sites

2 monitors connected to the same machine? I think all you have to do is put it further on the x or y axis, depending on how the monitors are placed.

for example:

GUICreate(@desktopwidth + 50, 50, 500, 500)

would make it appear on the second monitor if the 2 monitors were placed next to each other.

P.S. that would only work if @desktopwidth returns the width of one of the monitors, and not both (im not sure), so you could use @desktopwidth/2 if it returns the width of both.

Yeah, how to use the @Desktop... macros is what is confusing me. Because I run different resolutions on both monitors, I'm not sure how to get the variables using @Desktop... I guess I may be able to use WMI, however, I was hoping that they (the Devs) would include addition functionality to these macros to make my life easier :)

Share this post


Link to post
Share on other sites

Because I run different resolutions on both monitors

Where does that get you? I don't have more than one monitor, so I have no idea what that would do for you.

You could use WinSetPos() to put a GUI window on a different monitor... I wouldn't know how to go about making it open on that monitor though...


What goes around comes around... Payback's a bitch.

Share this post


Link to post
Share on other sites

I have monitor 1 set up for 1280 x 1024 and monitor 2 set up for 1024 x 768. It's weird but the AU3Info tool reports:

Overall Size

x: -1280

y: 0

w: 2304

h: 768

With each monitor coordinates as follows:

Monitor 1

Upper Left: x: -1280 y: 0

Lower Right: x: -1 y: 1023

Monitor 2

Upper Left: x: 0 y: 0

Lower Right: x: 1023 y: 767

From this it isn't too hard to place items but if I was to change resolutions, I run into the problem of not being able to automatically detect the new resolutions on both monitors from within a program (I would have to manually put them in as variables).

Share this post


Link to post
Share on other sites

#10 ·  Posted

You could use WinSetPos()

This function is not listed in v3.2.0.1 or v3.2.3.13 (beta) Help files - did you mean WinMove()?

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Yeah, that one.

It's been so long since I have used window functions, sorry.

EDIT: just read your 2nd to last post...

WinMove($title, $text, $x / $CurrentxResolution * $NewxResolution, $y / $CurrentyResolution * $NewyResolution)?

Edited by Kickassjoe

What goes around comes around... Payback's a bitch.

Share this post


Link to post
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
Sign in to follow this  
Followers 0