Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

AutoIT Script refresh and focus and auto-submit

Posted on 2012-04-11
12
Medium Priority
?
3,194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 83

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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Suggested Courses

722 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