Link to home
Start Free TrialLog in
Avatar of holemania
holemania

asked on

Bat File - Focus and Refresh IE

I don't know if this is possible, but doing some googles didn't return much result.  I want to create a bat file that I will schedule to run every 30 minutes.  I want this bat file to focus on Internet Explorer, do a Refresh, and finall an Enter key and then close.

Basically, I have a reporting services that requires some parameters.  Each time I hit "F5" to refresh it would error out.  I have a user that would like to have the report refresh every 30 minutes so he can get most up to date info without having to do it every 30 minutes or so.   I was thinking that if I can get a bat file to focus on IE and refresh the page, it would fix his problem.  Only issue is that since there are some parameters involve, it would error out if I hit "F5".  

Error is:  The page cannot be refreshed without resending the information.  Click retry to send the information again, or click cancel to return to the page that you were trying to view.

So I was hoping that a bat file can be set to focus on IE, hit F5, and then either hit "R" or "enter" key to get rid of the error.  If it does it quick enough, it would be seamless to the user other than his browser refreshing every 30 minutes.

So anyone might be able to help with such a script or point me to something that I can use as an example to get started?  Criteria is focus on IE, hit "refresh" or "F5", and then hit "R" or "Enter" key.  If there's a better way, that'll be even better.  Thanks in advance.
Avatar of jawa29
jawa29
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi

Is this a page you have control over? If it is then you can add this to the HTML.

<meta http-equiv="refresh" content="5">

Open in new window


content="5" is seconds.

This would refresh the page from the server end and not require the content to be re-submitted.

Jawa29
Avatar of holemania
holemania

ASKER

I don't have control over this page.  The report is from reporting services.  If the report has no parameters, it can be set to execute at different interval.  The issue is that with parameters, you can't set it to execute without defaulting.  The user can put in any value they want for the parameter.

My thoght was to focus on IE and then refresh.  However, with the parameter when refreshing it pop up with that error.  So if it can be set to do some keystrokes in sequence, it will resolve the pop up as well.
Avatar of Steve Knight
AutoIt might be your option here:

http://www.autoitscript.com/site/autoit/downloads/

You can setup a simple script to watch for the IE window title, send the F5 key perioidcally etc. in text editor then either have Autoit installed on this computer and run the .au* file or you can compile it into an exe and run it on anything.

Works great... used it for years!

You may also be able to get away with using VBScript and Sendkeys

Steve
I haven't tested this, but in theory it should work.  How about loading the page over which you have no control into a separate frame of its own in a local page over which you do have control of the code.  Add a "Meta Refresh" in the local HTML file which should then reload the page from the Internet as well?  If the user needs the page to reload every 30 minutes, then I would have thought that he/she would have been there to just click the "Retry" button in the message box as it happens.
Thanks for the inpute all.  Yes, vbscripting might be the path to go.  Although I'm not too great with VBScripting, I"m not sure if it's possible to focus on IE.  I'm sure the keypress is possible.  Just the focusing part.  Anyone with vbscripting background can assist?

BillDL, I think that might be an option.  Although if I hit refresh, I still get the "Retry" message pop-yo.  The entire idea is to avoid having the user to click on this every 30 minutes.  He is not sitting there waiting to refresh it every 30 minutes.  However, he wants the information to refresh every 30 minutes so that whenever he looks at the data it is up to date.
Give autoit a try if you can :-)
ASKER CERTIFIED SOLUTION
Avatar of jawa29
jawa29
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you.  Both worked well.
Oh well guess I should have written the scripts in full rather than just suggesting using Autoit or sendkeys before someone else wrote it...