Formatering af skærmudskrift
<plugin compatible="61" ><panel
caption="Valutakurser"
description="This panel displays Dkk foreign exchange rates"
icon="euro.bmp"
category="news_cat"
categoryIcon="basicpanels.dll,254,8"
author="DS Team"
email="support@desktopsidebar.com"
homepage="http://www.desktopsidebar.com">
<canvas>
<listoutput id="output" >
<event id="click" action="onClick" />
</listoutput>
</canvas>
<properties>
<page name="General Props">
<property name="currencies" label="Currencies" type="text" default="EUR USD GBP SEK NOK ">
Please enter here currencies symbols separated with spaces
</property>
</page>
</properties>
<script menu="dkkmenu">
<![CDATA[
var fso = new ActiveXObject("Scripting.FileSystemObject");
function getTempFileName()
{
var tfolder, tfile, tname, fname, TemporaryFolder = 2;
var tfolder = fso.GetSpecialFolder(TemporaryFolder);
var tname = fso.GetTempName();
return tfolder.Path+"\\"+tname;
}
function getXmlUrl()
{
return "http://www.nationalbanken.dk/dndk/valuta.nsf/valuta.xml";
}
function onLoadFinished(success, fileName, param)
{
output.Clear();
if (success)
{
var dict = new ActiveXObject("Scripting.Dictionary");
var currencies=config.GetSetting("currencies");
var ar = currencies.split(" ");
for(var i=0;i<ar.length;++i)
{
dict.Add(ar[i]," ");
}
var errMsg;
var xmlNode=sidebar.OpenXml(fileName,errMsg);
if (xmlNode)
{
var cube=xmlNode.GetNode("dailyrates");
for(var i=0;i<cube.GetChildCount();++i)
{
var node=cube.GetChild(i);
var currency=node.GetAttribute("code");
var rate=node.GetAttribute("rate");
if (dict.Exists(currency))
{
var row=output.AddRow();
row.SetText(currency+" "+rate);
}
}
}
else
{
var row=output.AddRow();
row.SetText("Cannot open xml");
}
fso.DeleteFile(fileName);
}
else
{
var row=output.AddRow();
row.SetText("Cannot download xml");
}
}
function onTick()
{
DownloadFile(getTempFileName(), getXmlUrl(), "onLoadFinished", 0);
}
function onClick()
{
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("http://www.nationalbanken.dk");
}
function onSettingsChanged()
{
StopTimer();
DownloadFile(getTempFileName(), getXmlUrl(), "onLoadFinished", 0);
SetTimer("onTick",3*60*60,0);
}
function onShowSources()
{
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("notepad.exe "+sidebar.GetInstallDir()+"dkk.dsplugin");
}
output.SetTab(0,50);
output.AddRow().SetText("Loading...");
DownloadFile(getTempFileName(), getXmlUrl(), "onLoadFinished", 0);
SetTimer("onTick",3*60*60,0);
]]>
</script>
</panel>
<commands>
<command name="dkk.showSources" caption="Show Sources" action="onShowSources" />
</commands>
<menus>
<menu name="dkkmenu">
<option cmd="dkk.showSources" />
</menu>
</menus>
</plugin>
Først skal siges at jeg ikke ved om det er rette katagori:
men den her linje skal rettes til at udskrive "rate"
row.SetText(currency+" "+rate);
så det står på skærmen højrestillet ?