G
GaryB
Hi,
(Posted this in scripting.wsh before I realised that it might be better
placed here - sorry if you;ve got two copies)
I want my (IE) Intranet users to be able to create a new Word document
based on a specified template.
The following works, but I would like to be able to pass the filename
as a parameter, as there are often multiple documents on the same page:
---------------Script Code Starts-------------
<script lang="Javascript1.2">
function NewDoc()
{
var oShell
oShell = new ActiveXObject ("WScript.Shell");
oShell.Run('cmd /K "C:\\Test.dot"', 0, false);
window.event.cancelBubble = true;
return false;
}
</script>
---------------Script Code Ends-------------
---------------Link Code Starts-------------
<a href=":" onclick="return NewDoc()">Create a new document based on
C:\Test.dot</a>
---------------Link Code Ends--------------
I know to specify the document template name as follows:
---------------Link Code Starts-------------
<a href=":" onclick="return NewDoc('C:\\Test.dot')">Create a new
document based on C:\Test.dot</a>
---------------Link Code Ends--------------
And change the "Function NewDoc()" in the script code to line to
"Function NewDoc(TemplateName)". The problem is that I don't know what
syntax to use to parametise the
"oShell.Run('cmd /K "C:\\Test.dot"', 0, false);"
line.
Thank you very much - and, while I'm at it, if you are able to point me
to a library of WSH sample files and/or a resource for learning how to
use WSH within an Intranet context, I'd be very grateful.
Regards
Gary Bartlett
(Posted this in scripting.wsh before I realised that it might be better
placed here - sorry if you;ve got two copies)
I want my (IE) Intranet users to be able to create a new Word document
based on a specified template.
The following works, but I would like to be able to pass the filename
as a parameter, as there are often multiple documents on the same page:
---------------Script Code Starts-------------
<script lang="Javascript1.2">
function NewDoc()
{
var oShell
oShell = new ActiveXObject ("WScript.Shell");
oShell.Run('cmd /K "C:\\Test.dot"', 0, false);
window.event.cancelBubble = true;
return false;
}
</script>
---------------Script Code Ends-------------
---------------Link Code Starts-------------
<a href=":" onclick="return NewDoc()">Create a new document based on
C:\Test.dot</a>
---------------Link Code Ends--------------
I know to specify the document template name as follows:
---------------Link Code Starts-------------
<a href=":" onclick="return NewDoc('C:\\Test.dot')">Create a new
document based on C:\Test.dot</a>
---------------Link Code Ends--------------
And change the "Function NewDoc()" in the script code to line to
"Function NewDoc(TemplateName)". The problem is that I don't know what
syntax to use to parametise the
"oShell.Run('cmd /K "C:\\Test.dot"', 0, false);"
line.
Thank you very much - and, while I'm at it, if you are able to point me
to a library of WSH sample files and/or a resource for learning how to
use WSH within an Intranet context, I'd be very grateful.
Regards
Gary Bartlett