Jump to content

Interact (ControlSend) with a specific IE window


 Share

Recommended Posts

I am trying to send F5 to a hidden Internet Explorer window, and only to that window.

It does however, work if it's the only IE window in existence.

If I start a new instance of IE, the script wants to interact with that, not my hidden one.

Another problem I'm having is it will not unhide the window when the script exits.

#include <IE.au3>
OnAutoItExitRegister("ShowIE")
$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")
WinSetState("[CLASS:IEFrame]", "Google", @SW_HIDE)
While 1
Sleep(60000)
ControlSend("Google", "", "[CLASS:Edit; INSTANCE:1]", "{F5}")
WEnd
 
Func ShowIE()
WinSetState("[CLASS:IEFrame]", "", @SW_SHOW)
EndFunc   ;==>ShowIE
Link to comment
Share on other sites

Hi NewPlaza,

why you want to send [F5] to your browser? Not better is use _IENavigate to the same page again?

Another problem I'm having is it will not unhide the window when the script exits.

Because you are using:

OnAutoItExitRegister("ShowIE")

Remove it.

Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Link to comment
Share on other sites

Ramzes,

Thanks. I didn't think of that. I have changed it to _IENavigate. I think this will work better.

I'm still having problems on how to unhide the window after I exit the script.

It does, however, works if it's the only IE window in existence.

But if I start opening up new instances of IE, it doesnt.

As you sugested, I removed the OnAutoItExitRegister func call and it will not work at all.

It leaves hidden IE windows that I can't see or close. I have to launch the Task Manager and end the iexplore.exe process.

Anyone know how can fix this?

Thanks.

New code:

#include <IE.au3>
;OnAutoItExitRegister("ShowIE")
$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")
WinSetState("[CLASS:IEFrame]", "Google", @SW_HIDE)
While 1
Sleep(60000)
_IENavigate($oIE, "http://www.google.com")
;ControlSend("Google", "", "[CLASS:Edit; INSTANCE:1]", "{F5}")
WEnd
 
Func ShowIE()
WinSetState("[CLASS:IEFrame]", "", @SW_SHOW)
EndFunc   ;==>ShowIE
Edited by NewPlaza
Link to comment
Share on other sites

GOT IT!

_IEQuit ($oIE)

Remarks

_IEQuit is particularly important when creating or working with invisible instances of Internet Explorer. When AutoIt exits when working with visible instances of a browser, the browser continues to run and the visible window is left for the user to manage. When the browser instance is invisible however, when AutoIt exits the browser process is left running and there is no user interface to interact with and an orphan Iexplore.exe process is left running on the system.

The help file is remarkable! :graduated:

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...