Hi Steve,
If you have any sample script , please send to me.
OK, but, I have a fair bit of infrastructure built up in this form,
mainly for supporting user configurable preferences, and I decided to
take some of it out but leave some of it in. The stuff I have left in
-- anything related to my Globals object -- should be self
explanatory.
setTimeout method
<URL:
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setTimeout.asp
/>
--- script.js ---
var Globals = { ... stuff ... }
var oTaskPane = null;
var gfInitialized = false;
function InitTaskPane()
{
if (null == oTaskPane)
{
if (null == XDocument.View)
return;
oTaskPane = XDocument.View.Window.TaskPanes.Item(0);
}
if (oTaskPane.HTMLDocument.readyState != "complete")
{
return;
}
gfInitialized = true;
}
function GetTaskPaneWindow()
{
if (oTaskPane)
{
if (Globals.HasFullTrust)
return oTaskPane.HTMLWindow;
else
return oTaskPane.HTMLDocument.parentWindow;
}
return null;
}
// Give the click handler for the Refresh button a valid JScript name
// so that it can also be called from script.
RefreshData = function Refresh::OnClick()
{
XDocument.Query();
if (Globals.Preferences.RefreshPeriodically == "T" &&
Globals.Preferences.RefreshInterval)
GetTaskPaneWindow().StartAutoRefresh();
}
--- taskpane.htm ---
var XDocument = null;
var iRefreshTimer = null;
var fAutoRefresh = false;
function Init()
{
// Save a reference to the XDocument
object.
XDocument =
window.external.Window.XDocument;
// Set the initial state of the task
pane contents.
XDocument.Extension.InitTaskPane();
}
function StartAutoRefresh()
{
var iInterval =
XDocument.Extension.Globals.Preferences.RefreshInterval;
if (isNaN(Number(iInterval)))
return false;
if (iRefreshTimer)
clearTimeout(iRefreshTimer);
iRefreshTimer =
setTimeout("Refresh()", iInterval * 1000);
fAutoRefresh = true;
return true;
}
function StopAutoRefresh()
{
if (iRefreshTimer)
clearTimeout(iRefreshTimer);
}
function PauseAutoRefresh()
{
fAutoRefresh = false;
}
function ResumeAutoRefresh()
{
fAutoRefresh = true;
}
function Refresh()
{
if (fAutoRefresh)
XDocument.Extension.RefreshData();
}