We help IT Professionals succeed at work.

Autoit script question with _IEAttach

Bobo--just_East_of_Madison
Bobo--just_East_of_Madison used Ask the Experts™
on
Hello:

I have the following script (creds. to big_daddy0690) refreshing a web page based on it's IE title; I'd like to include in the process another page in IE.

I've added $oIE = _IEAttach('page two title to refresh') to the script (see below)  but it only executes the second page title instance, not the first.

#NoTrayIcon
#include <IE.au3>

HotKeySet('{PAUSE}', 'FNC_EXIT')

_IEErrorHandlerRegister()
$oIE = _IEAttach(page one title to refresh')
$oIE = _IEAttach('page two title to refresh')

While 1
	Sleep(5000) ;five minutes
	__IELockSetForegroundWindow(1)
	_IENavigate($oIE, _IEPropertyGet($oIE, "locationurl"))
	__IELockSetForegroundWindow(2)
WEnd

Func FNC_EXIT()
	Exit
EndFunc

Open in new window


Any ideas?

Thanks,

Bobo
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Try this:

#NoTrayIcon
#include <IE.au3>

HotKeySet('{PAUSE}', 'FNC_EXIT')

_IEErrorHandlerRegister()
$oIE_PageOne = _IEAttach("page one title to refresh")
$oIE_PageTwo = _IEAttach("page two title to refresh")

While 1
	Sleep(5000) ;five seconds
	__IELockSetForegroundWindow(1)
	_IENavigate($oIE_PageOne, _IEPropertyGet($oIE_PageOne, "locationurl"))
	__IELockSetForegroundWindow(2)
	__IELockSetForegroundWindow(1)
	_IENavigate($oIE_PageTwo, _IEPropertyGet($oIE_PageTwo, "locationurl"))
	__IELockSetForegroundWindow(2)
WEnd

Func FNC_EXIT()
	Exit
EndFunc

Open in new window

Perfect.
Thanks again.

-Bobo
You're welcome. I wrote the previous code in a hurry. This would be more efficient.

#NoTrayIcon
#include <IE.au3>

HotKeySet('{PAUSE}', 'FNC_EXIT')

_IEErrorHandlerRegister()
$oIE_PageOne = _IEAttach("page one title to refresh")
$oIE_PageTwo = _IEAttach("page two title to refresh")

$i5Min = (1000 * 60 * 5)
$i1Min = (1000 * 60 * 1)

While 1
	Sleep($i5Min) ;five minutes
	__IELockSetForegroundWindow(1)
	_IENavigate($oIE_PageOne, _IEPropertyGet($oIE_PageOne, "locationurl"), 0)
	_IENavigate($oIE_PageTwo, _IEPropertyGet($oIE_PageTwo, "locationurl"), 0)
	_IELoadWait($oIE_PageOne, 0, $i1Min)
	_IELoadWait($oIE_PageTwo, 0, $i1Min)
	__IELockSetForegroundWindow(2)
WEnd

Func FNC_EXIT()
	Exit
EndFunc   ;==>FNC_EXIT

Open in new window