Sign in to follow this  
Followers 0
mjg

Is this possible? (Program/Monitor Switch)

2 posts in this topic

I have two monitors, and I'm trying to figure the most efficient way to move all active programs on monitor A to monitor B (same location as on monitor A, just on monitor :) and then move any active applications on monitor B to monitor A (basically just swapping monitors). I'm still fairly novice at AutoIT and really don't know where to start for such an application.

Any ideas?

-mjg

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Umm I think you need to be more descriptive.

Is your desktop spanning 2 screens?

What result do you get from this code?

MsgBox(0,"",@DesktopWidth)

What is your desktop resolution?

Try this:

#include <array.au3>
$result = WinList ("")
_ArrayDisplay($result)

$var = WinList()

For $i = 1 to $var[0][0]
  ; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
    ;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
    $currentPosition = WinGetPos ($var[$i][1])
    If $currentPosition[0] < (@DesktopWidth / 2) Then
        WinMove($var[$i][1], "", $currentPosition[0] + (@DesktopWidth / 2), $currentPosition[1])
    EndIf
  EndIf
Next

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf
EndFunc
Edited by weaponx

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