Post Reply
Kayef 2011-10-08 05:13
Hi,
I am using your VBScripts to launch and position browsers on separate monitors.
How can I use sendKeys to emulate pressing an F11 key on a browser after launching and moving it?
I tried using sendKeys on a Ultramon.window and it seems that it is not sending to the browser but the Ultramon.window object.
Objective: To launch multiple instances of a browser (Firefox, chrome ,opera) , move it to a specified monitor and make it fullscreen.
Thanks
|
Christian Studer 2011-10-08 08:24
SendKeys sends the key combination to the active window, this will cause timing issues if you call it immediately after launching the application.
Couldn't you just launch the browser in fullscreen mode via command line switch, for example Internet Explorer supports this via the -k switch:
"%ProgramFiles%\Internet Explorer\iexplore.exe" -k http://www.realtimesoft.com
Christian Studer - www.realtimesoft.com
|
Kayef 2011-10-08 17:43
I'm currently using the -Kiosk switch for opera, it works but I'm only able to launch 1 instance of it.
What I need is to launch a few instance of the same browser (anything but IE) and move each of it to a separate monitor (theres more than 2 monitors)and display it fullscreen.
|
Christian Studer 2011-10-09 07:42
This is browser-specific, for example with Firefox the following script will work fine:sites = Array("http://www.realtimesoft.com", "http://www.microsoft.com")
captions = Array("Realtime Soft - Mozilla Firefox", "Microsoft *- Mozilla Firefox")
monitors = Array(2, 3)
Const BROWSER = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Const TIMEOUT = 10 'number of seconds to wait for the browser to start
Set util = CreateObject("UltraMon.Utility")
Set wnd = CreateObject("UltraMon.Window")
Set sh = CreateObject("WScript.Shell")
For i = 0 To UBound(sites)
If util.Run(BROWSER & " -new-window " & sites(i)) = True Then
If wnd.Find(captions(i), "", 1, 0, TIMEOUT * 1000) = True Then
wnd.Monitor = monitors(i)
wnd.ApplyChanges 0
wnd.Activate
sh.SendKeys "{F11}"
End If
End If
NextYou need to use the -new-window switch for Firefox because otherwise all sites get opened in multiple tabs in the same browser instance, and you need to use Window.Find to position the instances based on window caption due to the way Firefox handles multiple instances.
Christian Studer - www.realtimesoft.com
|
Post Reply
|