pass variable to HTA

S

Sharon

Hi!
After transforming XML to CSV format I open an HTA to save the CSV to
the client. All goes well, the function looks like this:

function buttonExportClick()
{
var xslt = new ActiveXObject('Msxml2.XSLTemplate.3.0');
var s = new ActiveXObject('msxml2.FreeThreadedDOMDocument.3.0');
s.async=false;
s.load("/lib/xtable/convert.xsl");
var xslProc;
xslt.stylesheet = s;
var xmlDoc = document.XMLDocument;
if (xmlDoc==null)
{xmlDoc=navigator.XMLDocument};
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.transform();
output = xslProc.output;
var newwin = window.open('/lib/xtable/htatest.hta');
}

However, to be able to save the CSV I need to pass the variable
'output' (which is the transformation output) to the HTA. I have tried
several ways to do this, but none of them will work. Can anyone help
me? I hope someone knows how to do this, thanks in advance!
Sharon
 
K

kaeli

output = xslProc.output;
var newwin = window.open('/lib/xtable/htatest.hta');
}

However, to be able to save the CSV I need to pass the variable
'output' (which is the transformation output) to the HTA. I have tried
several ways to do this, but none of them will work. Can anyone help
me? I hope someone knows how to do this, thanks in advance!

Did you try passing it via the URL and getting it from location.search?
var newwin = window.open('/lib/xtable/htatest.hta?'+output);

--
 
J

J. J. Cale

Sharon said:
Hi!
After transforming XML to CSV format I open an HTA to save the CSV to
the client. All goes well, the function looks like this:

function buttonExportClick()
{
var xslt = new ActiveXObject('Msxml2.XSLTemplate.3.0');
var s = new ActiveXObject('msxml2.FreeThreadedDOMDocument.3.0');
s.async=false;
s.load("/lib/xtable/convert.xsl");
var xslProc;
xslt.stylesheet = s;
var xmlDoc = document.XMLDocument;
if (xmlDoc==null)
{xmlDoc=navigator.XMLDocument};
xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.transform();
output = xslProc.output;
var newwin = window.open('/lib/xtable/htatest.hta');
}

AFAIK an hta behaves like any other html document but
then, what do I know. This isn't tested.

var newwin = window.open('/lib/xtable/htatest.hta?output');
then use location.search in the hta to see your variable
HTH
Jimbo
 
S

Sharon Steringa

Thanks, works great! However, the variable I'm passing can be rather
big, depending on the table I'm transforming into CSV format. When it
gets bigger than, say, 60 records, there's an error when I try to call
the HTA and pass the variable via the URL. Is there any other way to
pass big long strings, or should I break them up or something? Hope you
can help me!
Sharon
 
K

kaeli

Thanks, works great! However, the variable I'm passing can be rather
big, depending on the table I'm transforming into CSV format. When it
gets bigger than, say, 60 records, there's an error when I try to call
the HTA and pass the variable via the URL. Is there any other way to
pass big long strings, or should I break them up or something? Hope you
can help me!

Actually, no, there really isn't a way once the URL gets really long. There's
a limit of like 255 chars, I *think*.

Possible workarounds to consider:

1. Write output to temp file, pass name of temp file in URL, use temp file in
HTA. Original application must have write permissions somewhere for this to
happen. If you have problems, try using the temp internet files cache.

2. Object persistence. Make the activex object part of a real object (you
create) with a getter and setter instead of declaring it in the function,
then have the hta get the object itself from its opener. Note that this will
only work if the opener is available (if window closed, no good).

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top