Solved

AutoIT Script refresh and focus and auto-submit

Posted on 2012-04-11
12
3,015 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 80

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

735 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