Solved

AutoIT Script refresh and focus and auto-submit

Posted on 2012-04-11
12
2,924 Views
Last Modified: 2012-04-17
Hello:

This is a continuation of the question in thread Q_27640249.

1.

The following script I'm using to automatically refresh a Web page using the title of the page to identify it (code was supplied by matrixnz):

#NoTrayIcon
#include <IE.au3>

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

Local $oIE = _IEAttach('Webtop')

While 1
  Sleep(10000)
  _IEAction($oIE, 'refresh')
WEnd

Func FNC_EXIT()
  Exit 0
EndFunc

Open in new window


When dealing with a page like www.yahoo.com, it does not take focus off.
However, when dealing with an internal page on my company's network, focus is removed; here's what I can disclose as far as the internal page is concerned:

Server is Apache Tomcat
It's SSL
Log in is required
Doc type is HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"

2.

Other question is that on one of the pages I'm running the refresh tool, I receive a dialog box that I need to click "Retry" on. I would like to integrate that into the AutoIT executable; but I'm wondering if this will take focus off as well; attached is a screenshot of the dialog box that appears on refresh.

retry-dialog-box-on-browser-refresh
0
Comment
  • 6
  • 5
12 Comments
 
LVL 78

Expert Comment

by:David Johnson, CD, MVP
ID: 37836218
That is exactly the problem.. it is a secured page.. if you refresh it it will always bring up this dialog (TTBOMK)
0
 
LVL 8

Expert Comment

by:big_daddy0690
ID: 37837308
First I'd like to get a better understanding of what you are trying to achieve with refreshing the page. Examples; Needing to refresh data so that it can be viewed at will, Needing to monitor webpage for changes to that some action can be taken, Need to emulate human activity on the webpage.

If you wanted to refresh the data on your internal website how would you do it? Is there a refresh button provided on the webpage that does not initiate that prompt or must you use the browsers refresh button?

Note: Whoever wrote that script attempted to create a local variable in the global scope. *facepalm*
0
 

Author Comment

by:Bobo--just_East_of_Madison
ID: 37837555
@big_daddy0690

This is not for server-side scripting; that is, I cannot put it on the WebPage I want refreshed.
0
 
LVL 8

Expert Comment

by:big_daddy0690
ID: 37838426
Yeah, I got that from your referenced question. Where in my comment did you get that I suggested that?
0
 

Author Comment

by:Bobo--just_East_of_Madison
ID: 37839731
@big_daddy0690

"If you wanted to refresh the data on your internal website how would you do it? Is there a refresh button provided on the webpage that does not initiate that prompt or must you use the browsers refresh button?"

But now based on your previous comment, I believe you were trying to lead me to an answer or a better way to pose my question.

What I'm trying to achieve is:

Prevent automatic log-outs because of inactivity while not taking focus.
0
 
LVL 8

Expert Comment

by:big_daddy0690
ID: 37839977
Try the following...

#include <IE.au3>

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

_IEErrorHandlerRegister()
$oIE = _IEAttach('Webtop')

While 1
	Sleep(10000)
	_IENavigate($oIE, _IEPropertyGet($oIE, "locationurl"))
WEnd

Func FNC_EXIT()
	Exit
EndFunc

Open in new window

0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:Bobo--just_East_of_Madison
ID: 37844277
@big_daddy0690

Still takes focus off; however, it is now returning focus, which it wasn't doing before.

Is "locationurl" a variable or value I'm sypposed to define?
0
 
LVL 8

Expert Comment

by:big_daddy0690
ID: 37844428
locationurl is a property that returns the currently displayed URL.

See if this keeps it from stealing focus.

#NoTrayIcon
#include <IE.au3>

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

_IEErrorHandlerRegister()
$oIE = _IEAttach('Webtop')

While 1
	Sleep(10000)
	_IEAction($oIE, "invisible")
	_IENavigate($oIE, _IEPropertyGet($oIE, "locationurl"))
	_IEAction($oIE, "visible")
WEnd

Func FNC_EXIT()
	Exit
EndFunc

Open in new window

0
 

Author Comment

by:Bobo--just_East_of_Madison
ID: 37856262
@big_daddy0690

Hmm.

Oddly enough, this version of the script minimizes the window and then maxizes the window after the refresh. The focus is stolen upon minimizing and maximizing.

So script with id no. 37839977 is the version closest to the desired result.

I'm actively researching this as well but I haven't found a resolution yet.

--Bobo
0
 
LVL 8

Accepted Solution

by:
big_daddy0690 earned 500 total points
ID: 37856831
See what results you get with the following...

#NoTrayIcon
#include <IE.au3>

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

_IEErrorHandlerRegister()
$oIE = _IEAttach('Webtop')

While 1
	Sleep(10000)
	__IELockSetForegroundWindow(1)
	_IENavigate($oIE, _IEPropertyGet($oIE, "locationurl"))
	__IELockSetForegroundWindow(2)
WEnd

Func FNC_EXIT()
	Exit
EndFunc

Open in new window

0
 

Author Closing Comment

by:Bobo--just_East_of_Madison
ID: 37857730
Success!

Thanks a bunch.

--Bobo
0
 
LVL 8

Expert Comment

by:big_daddy0690
ID: 37857801
Good to hear!

You're welcome.

--Bob
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now