...

View Full Version : Can't refresh/reload.hta



fuzzy1
07-16-2007, 11:05 PM
Hey All,

Gosh, I couldn't find the HTA users forum (wonder why that is? :p )
so I hope this post is as well placed here as anywhere?

I have a little hta running from a windows scheduled task,
which calls a couple of files (from two different servers) into
respective iframes in the hta.

Was running 'window.close()' if one of the files (mysql_query.php) echo's a 'true' result
(sync_blocking.status='true') better luck next time the task runs...

I would much prefer to run 'window.reload()' (try again) untill result returns 'false',
but I keep getting permission denied errors for the dozens of different reload/refresh/history options I have tried.
(window/document/parent/location ... how many ways to skin that cat anyway?)

I can do this...
function alternative(){
parent.StartThis('C:\\AreaPro\\checkStatus.hta');
window.close(); Which is a REALLY UGLY SOLUTION... , but I can't do ANYTHING like this "window.location.reload();"without a Permission Denied error.
Please, can anyone offer any good reason why the following wouldn't work?
(abreviated it as best I could, but thought it important to present in context)

<html>
<head>
<TITLE>Area Pro Sync</TITLE>

<HTA:APPLICATION id="checkStatusHTA"
applicationName="checkStatus"
border="thin"
borderStyle="normal"
caption="yes"
icon="C:\AreaPro\sync3.ico"
maximizeButton="yes"
minimizeButton="yes"
showInTaskbar="yes"
windowState="normal"
innerBorder="yes"
navigable="yes"
scroll="no"
scrollFlat="yes"
singleInstance="no"
sysMenu="yes"
contextMenu="yes"
selection="yes"
application="yes"
version="1.0" />

<script language="javascript" type="text/javascript">
window.resizeTo(400,600);
self.moveTo(300,50);

var shellObject = new ActiveXObject("Shell.Application");
function StartThis(CommandToRun)
{
shellObject.open(CommandToRun)
}

function verify_connection()
{
var connected = document.getElementById('connected');
var check_statusIframe = document.getElementById('check_statusIframe');
if(connected.value!='false')
{
setTimeout("check_statusIframe.src='http://mydomain.com/crm/checkStatus.php'",3000);
}
else{
//alert("no connection")
window.close();
}
}

function start_Sync(){
parent.StartThis('C:\\AreaPro\\bg_Sync.bat');
window.close();
}

function alternative(){
parent.location.reload();//try again until checkStatus.php echos startSync();
}
</script>
</head>
<!-- verify host connection first - if(connected){run scripts} else{close/abort} -->
<body onload="verify_connection();">
<img src="http://mydomain.com/connected.gif" onError="document.getElementById('connected').value='false';">
<input type="hidden" id ="connected">
<!-- END verify connection -->

<iframe id="pirmary_userIframe" width="200" height="100" frameborder="1" application="yes" border="1" src="http://localhost/crm/get_prime_user.php">
</iframe>
<iframe id="check_statusIframe" width="400" height="40" frameborder="1" application="yes" border="1">
</iframe>
</body>
</html>

_Aerospace_Eng_
07-16-2007, 11:14 PM
While an hta is a little more lax on security I still believe you can't reload an iframe if its from an external url unless I'm missing something. What are you trying to reload? The .hta file or the iframe?

fuzzy1
07-16-2007, 11:16 PM
Well, I think I have succeeded in reloading the iframes (both of them)
but REALLLY want to reload the HTA.

Thanks!

_Aerospace_Eng_
07-16-2007, 11:29 PM
Try the other ways mentioned here
http://www.mediacollege.com/internet/javascript/page/reload.html
If those don't work you could also try a meta refresh.

fuzzy1
07-17-2007, 12:04 AM
Thanks Aero,
I've tried ALL those, 100 variations on them and few othes to boot:(
history.go(0) is as close as I've gotten, which (like a simple refresh from the browser) Alerts "Page cannot be refreshed without resending the information. -- RETRY"

This of course will never do in a task scheduled by a bakground windows user
(cause you'd never see it run to click retry).

Which leaves my scrathching mE head (wait -- is that blood under my fingernails ? !!! ?) wondering....

WHAT information is it that must be RE SENT ????

_Aerospace_Eng_
07-17-2007, 12:46 AM
You have something posting to the server so refreshing the page will try to repost the information back to the server. You may want to look into using ajax to get the response from the server.

fuzzy1
07-17-2007, 01:55 AM
Thanks Again for your help Aero,

No end to the learning curve here is there?
Ajax has been knocking on my door for months.

I'm pretending I'm not home.

Strangely (to me anyway) I was able to echo the following from checkStatus.php, and it works like a charm! Go figure.
echo "<script>
if(window.parent.is_checkStatus_hta)
{
//try again until $status =='no' && checkStatus.php echos startSync();
window.parent.location.reload();
}
</script>";



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum