Jump to content

Recommended Posts

Posted

Hello,

I'm having a problem whit winwait on firefoxscreens whit the same title and text.
On mine quest on this forum and internet I've found some work around and solutions.
unfortunaly This wasn't working for me.

I've tried searching tru winlist or finding some unique text but wasn't finding any solution.
Does anyone know how to get the wright handle?
I just want to move the browser to the right place in the end whit WinMove.

thnx in advanced.

 

#include <Array.au3>
Global $A_URL[4][2] =  _
      [["url1" , "same_title"] , _
      ["url2", "same_title"] , _
      ["url3" , "other_title" ] , _
      ["url4" , "other_title" ]]
;~ _ArrayDisplay($A_URL)

;-----kill all firefox.exe
;~ Run("taskkill /IM firefox.exe /F", "", @SW_HIDE)
;Sleep(5000)

For $i = 0 To 1
   ConsoleWrite("running 1 : " & $i & @CRLF)
   Local $ID = ShellExecute("firefox.exe", "-new-window " & $A_URL[$i][0] ,"C:\Program Files\Mozilla Firefox" )
   ConsoleWrite("$ID = " & $ID & @CRLF)
Next
sleep(200)
;~    Local $screen1HWND = WinWait($A_URL[0][1],"")
;~    If Not WinActive($screen1HWND) Then WinActivate($screen1HWND)
;~    ConsoleWrite("$screen1HWND = " & $screen1HWND & @CRLF)
;~    Local $screen2HWND = WinWait($A_URL[1][1],"")
;~    If Not WinActive($screen2HWND) Then WinActivate($screen2HWND)
;~    ConsoleWrite("$screen2HWND = " & $screen2HWND & @CRLF)
$sWinTitle = $A_URL[0][1]
$avWinList = WinList($sWinTitle)
For $n = 1 to $avWinList[0][0]
    ConsoleWrite("Window " & $n & ":  Text:  " & WinGetText($avWinList[$n][1]) & @LF)
Next

For $i = 0 To 1
;~    WinWait("title1", "", 10)
;~    WinActive("title1", "")
;~    WinMove ("title1", "", $i , $i )
Next

 

as finishing touch god created the dutch

Posted
16 minutes ago, FMS said:

Does anyone know how to get the wright handle?
I just want to move the browser to the right place in the end whit WinMove.

 

But witch is the right window if these are of the same Title and Text? Witch of the two browser windows do you want to move?

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Posted

both :)
the first i want to move to place 1 and the other to another place on the screen.

as finishing touch god created the dutch

Posted
#include <Array.au3>
Global $A_URL[4][2] =  _
      [["www.google.com" , "Google - Mozilla Firefox"] , _
      ["www.google.com", "Google - Mozilla Firefox"] , _
      ["www.google.com" , "other_title" ] , _
      ["www.google.com" , "other_title" ]]
;~ _ArrayDisplay($A_URL)


For $i = 0 To 1
   ConsoleWrite("running 1 : " & $i & @CRLF)
   Local $ID = ShellExecute("firefox.exe", "-new-window " & $A_URL[$i][0] ,"C:\Program Files\Mozilla Firefox" )
   ConsoleWrite("$ID = " & $ID & @CRLF)
Next

sleep(5000)

$sWinTitle = $A_URL[0][1]
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sWinTitle = ' & $sWinTitle & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console

$avWinList = WinList("[CLASS:MozillaWindowClass]")
;~ _ArrayDisplay($avWinList)

For $n = 1 to $avWinList[0][0]
    ConsoleWrite("Window " & $n & ":  Title:  " & WinGetTitle($avWinList[$n][1]) & @LF)
    ConsoleWrite("Window " & $n & ":  Text:  " & WinGetText($avWinList[$n][1]) & @LF)
Next

For $i = 1 To $avWinList[0][0]
    WinMove($avWinList[$i][1] , "", $i*50 , $i*50 )
Next

Give this a try...

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Posted

@ajag thanks for the reply, I'm a little bit further.
It is somewhat clearer how to deal whit this.

Unfortunaly I'm a little stuck in setting the right window on the right screen.
(This code is meant  to show 4 firefox windows on a computer whit 4 screens)

What I'm trying to do is link 1 on screen 1 and link 2 on screen 2 ......
(resolution is 1920*1080)

When I was trying things out it seems WinList give a random handle back and not in the order it was created (link 1 , link 2 ... ) .
Is there a way around this?

 

#include <Array.au3>
Global $A_URL[4][2] =  _
      [["www.google.com" , "Google - Mozilla Firefox"] , _
      ["www.google.com", "Google - Mozilla Firefox"] , _
      ["www.google.com" , "other_title" ] , _
      ["www.google.com" , "other_title" ]]
      
Global $resolution = 1920
Global $screen_count = 4

If kill_firefox() Then start_firefox()
If win_move() Then login_rotator()

Func kill_firefox()
;~    Run("taskkill /IM firefox.exe /F", "", @SW_HIDE)
;~    Sleep(5000)
   Return True
EndFunc

Func start_firefox()
   For $i = 0 To 3
      Local $ID = ShellExecute("firefox.exe", "-new-window " & $A_URL[$i][0] ,"C:\Program Files\Mozilla Firefox" )
      Sleep(500)
   Next
EndFunc

Func win_move()
   $avWinList = WinList("[CLASS:MozillaWindowClass]")
;~    _ArrayDisplay($avWinList)
   For $i = 1 To $screen_count
      WinMove($avWinList[$i][1] , "", (($i * $resolution) - $resolution) , 0 )
      Sleep(100)
      MouseClick("left", (($i * $resolution) - $resolution) + 10 , 80 )
      Send("{F11}")
      Sleep(1000)
   Next

   Return True

EndFunc

Func login_rotator()
   ;----- login rotator
   Sleep(1000)
   MouseClick("left", 4783 , 362)
   Sleep(2000)
   MouseClick("left", 3935, 552)

   ;----- remove mouse from screen
   MouseMove( 1301, 1078)
EndFunc

 

as finishing touch god created the dutch

Posted

Okay, then to be a bit more specific, could you please show real links?

I cannot believe that with different links all windows have the same title...

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Posted

unfortunaly this isn't posible because the links are inside a coorperate network and not accesible outside.
But I've tried to find something different in a lot of way's , even "Autoit v3 Window Information"-tool doesn't give me something to work whit :(

 

as finishing touch god created the dutch

Posted

But do all 4 browser windows show the same link (and the same content?)

> if yes, it does not matter witch window is shown on witch monitor, just position them randomly
> if no, then the windows shold have different titles...

I could not understand your problem

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Posted

No and yes :) , the first 2 URL's are diffrent but whit the same Title.
The other 2 are diffrent URL and diffrent Title.
It's build something like this, maybe it helps a little?

 

Global $A_URL[5][2] =  _
      [["URL" , "Window title"] , _
      ["http://url1/location1/#/" , "title"] , _
      ["http://url1/location2/#/" , "title"], _
      ["http://url1/location3/#/" , "title_unique1"] , _
      ["http://url1/location4/#/" , "title_unique2"]]

 

as finishing touch god created the dutch

Posted

You can try to identify the windows based on something different that the title or the text which are the same. I see that those are open in FireFox. You can use the FF udf to identify the windows. You can also use winlist  which will return title+handle so you can move the first window on one place and the second window on the other using the handle.

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
×
×
  • Create New...