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
Solved

AutoIT Script refresh and focus and auto-submit

Posted on 2012-04-11
12
2,989 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
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.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

840 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