Sign in to follow this  
Followers 0
shaktiku1

How to set focus on Win7 m/c opened using browser access

3 posts in this topic

Hi,

I am working on to send Keyboard keys to notepad opened in Win7 m/c(which i am accessing using webBrowser{called as console view} just like client-server) which is in maximized mode and focus is set to notepad.

I have created AutoIT script to get the handle of the browser's window but when i triggers AutoIT script through batch script it is not recognizing properly ,though its find the browser window properly but not sending the keys to notepad

I am attaching the screenshot of the opened Win7 m/c for reference(https://dl.dropboxusercontent.com/u/91420517/Insession.JPG

**If i run the AutoIT script and click inside the opened notepad,then sendkeys sends all the key properly.

$hFirefox = WinGetHandle("[CLASS:MozillaWindowClass; TITLE:FRwin7x64 - Mozilla Firefox]", "")
WinActivate($hFirefox,"")


; Character in Small letters
;--------------------------
Sleep(1000)
Send("a")
send("{ENTER}")
Send("b")
send("{ENTER}")
Send("c")
send("{ENTER}")
Send("d")
send("{ENTER}")
Send("e")
send("{ENTER}")

AutoIT Window Info

>>>> Window <<<<
Title:  FRwin7x64 - Mozilla Firefox
Class:  MozillaWindowClass
Position:   594, 46
Size:   836, 718
Style:  0x16CF0000
ExStyle:    0x00000100
Handle: 0x00040018

>>>> Control <<<<
Class:  
Instance:   
ClassnameNN:    
Name:   
Advanced (Class):   
ID: 
Text:   
Position:   
Size:   
ControlClick Coords:    
Style:  
ExStyle:    
Handle: 

>>>> Mouse <<<<
Position:   953, 174
Cursor ID:  0
Color:  0x0959AE

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<


>>>> Hidden Text <<<<

Please help in resolving this way or let me know the better way of finding the windows control. 

*Sorry if i not very clear is describing my issue.. 

Many Thanks in advance!!

Share this post


Link to post
Share on other sites



if this is remote control of some sort, then you issue is similar to running AutoIt over RDP/VNC/Citrix/etc.

search the forum, there are few solutions:

1) run the AutoIt script from the host itself, not from the terminal client.

2) use blind click based on coordinates and blind send() instead of ControlSend(). for these, the following conditions are required, depending on the method you choose:

method 1 - open-loop-control: make sure the remote app is located exactly in a specific coordinates, so Click based on coordinates will work; and use blind send() instead of ControlSend().

method 2 - closed-loop-control: use image recognition to detect the controls you wish to operate on.

in short: go for option (1) and run the AutoIt script from the host itself.

Share this post


Link to post
Share on other sites

you can use the title instead of the win handle 

try these:

WinActivate("firefox","")
WinActivate("mozilla","")

or what ever your browser name appears in the tool bar thingy


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