Jump to content

ControlSend Basic


 Share

Recommended Posts

Hi, I'm new to AutoIT and trying to understand the basic idea of how it works.

According to the help, ControlSend can send keys to an inactivated window as infact the example demonstrates.

However, somehow in my enviroment, it seems not to be functioning well. So could anybody here point me out what's wrong with this code? The Firefox window gets activated and shows up in front of my working window.

$keyword = "autoit"
ControlSend("[Class:MozillaUIWindowClass]", "", "MozillaWindowClass5", "^t")
ControlSend("[Class:MozillaUIWindowClass]", "", "MozillaWindowClass1", "www.google.com/search?hl=en&q=" & $keyword & "{enter}")

In addition, I tried to send Ctrl+K to the search box but with no succsess.

Link to comment
Share on other sites

... According to the help, ControlSend can ...

Welcome to the forum.

Look at the help file under ControlSend and you should find a link to "Controls:.

That page has info about Controls in general ans it states this:

Note: AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment!

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Thanks herewasplato, I found a page talking about this.

http://www.autoitscript.com/forum/index.php?showtopic=91937

So, it was due to the software's design which does't fully accept ControlSend.

I also tried in IE8 and this also responded like FireFox.

$keyword = "autoit"
ControlSend("[Class:IEFrame]", "", "Edit1", "^t")
sleep(100)
ControlSend("[Class:IEFrame]", "", "Edit1", "www.google.com/search?hl=en&q=" & $keyword & "{enter}")

Anyways, it was a good little experience for beginning this language. I appreciate it.

Link to comment
Share on other sites

When interacting with web pages, control send will not work. You can send key strokes to the MozillaUIWindowClass class but you will have to use the IE or FF libraries to interacted with elements on the web page.

You can see examples of the IE library in the help file - see _IEFormElementSetValue for some examples. The FF library is new so doc is not in the help file yet (hope it is in there soon) :)

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Link to comment
Share on other sites

... I also tried in IE8 and this also responded like FireFox. ...

There is not too much that is "standard" about IE.

I should have pointed you to the IE and FF functions - but I was a bit rushed during that post. :-(

Enjoy AutoIt and the forum :-)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

  • 2 weeks later...

Hey thx for the FF links...since the search-function here in the forum is a bit...öööhm....strange.

But anyway, firefox is working pretty well with controlclick() in active and hidden windows.

The only prob in firefox is, no Statusbar reading. (Pixelgetcolor not working while hidden)

If you know ANY way,...and I couldn't see any clue to the FF Library, that you can read statusbar on hidden windows in FF...letme know.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...