Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

AutoIT Script refresh and focus and auto-submit

Posted on 2012-04-11
12
Medium Priority
?
3,272 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 84

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
Independent Software Vendors: 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 2000 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

Technology Partners: 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!

Question has a verified solution.

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

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
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.
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 +…

772 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