WScript Syntax For Creating A New Document Based On A Word Template

Dec 1, 2005

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.

View 1 Replies


ADVERTISEMENT

Function To Save An Html Document As An Microsoft Word Document?

Feb 9, 2010

i want to save my html document as an microsoft word document will

View 14 Replies View Related

Syntax For Creating A Variable And Using It Immediately?

Aug 10, 2010

var x = "blahblah".indexOf("blahblah");
if (x !== -1){
// do something with x

[Code].....

Is there some syntax/code structure that allows something like this:

if ( (var x = "blahblah".indexOf("blahblah")) !== -1){
// do something with x
alert("Present");

[Code]....

View 3 Replies View Related

Document.write Syntax....

Jul 23, 2005

Recently writing some code i cross over a problem using document.write:

View 2 Replies View Related

Create New Word Document?

Apr 15, 2009

I've posted several messages concerning a program I am working on which uses a webform to create a document at the end.

So far I am able to create the doc and copy to clipboard for pasting using the c[code]...

What I would like to do is create a new word doc and populate it with the created document. I've tried with no success using activeX etc. The best I could do was to open an existing word doc, but could not populate it. I need it to open a new blank word window, as it is not practical to have a specified word file already there.

View 3 Replies View Related

Identify Macro In A Word Document Using C#

Jun 25, 2007

i m trying to write a code to identify macros in a word document using
c#,also if any macro exist i want to delete those from doc file using
c#

View 1 Replies View Related

Save HTML In Word Document?

Nov 10, 2010

I need to save an HTML page to Word using JavaScript. I have found some script on-line but all of them use the "Save As" procedure which only allows to save in txt and html format. I need it to be in Word.

View 2 Replies View Related

Create A Global Template Or "master Document" To Link As Would In A Style Sheet?

Feb 15, 2010

I find I often have to change links in templates. I work for someone who is always wanting to alter their links. Is it possible to create a global template, or "master document" to link to as you would in a style sheet? This is what I want to do: Have 1 document that contains links. When I make changes to this document, all links on all pages would change also.

View 5 Replies View Related

Load<A HREF='document.doc'> In Word - Not In Explorer????

Jul 20, 2005

I have an intranet web page with links to all kinds of Microsoft Word
document that we use at my work, so my co-works can go to the web page when
they need a special document. However, when they click the links the
documents are of cause loaded in the web browser MS Explorer and not opened
in MS Word, which is annoying.

Are there any tricks - in VBScrip, JavaScript, Java or simply in HTML, that
let me load a Word-link in Word and not in Explorer?

View 2 Replies View Related

Save Html Page As Word Document?

Mar 7, 2009

I have one save button in my html page and as soon as i click that button using javascript's onclick function the html/static page should be saved with .doc extension.As of now i want only the text in the html page to be saved as word document.But if possible suggest me for html pages with images too.I want the logic or sample source code for the above mentioned requirement

View 3 Replies View Related

Use OnLoad To Change The Color Of A Word Within Document?

Oct 3, 2010

I have a simple html document that is dynamically created. It comes to me like this:

<body>
432 (Locked) (Disabled) <br />
545 (Unlocked) (Enabled) <br />
756 (Unlocked) (Disabled) <br />
</body>

The actual list is much longer and varies in length. What I am attempting to do is when a user opens the page, if a line contains Locked or Disabled, change the color of those words (or the whole line that contains them) to red.

View 7 Replies View Related

Get Printer Status And Print MS Word Document?

Aug 24, 2009

I need to know this one. How can we get printer status using JavaScript and also how can we give MS word document print command using JavaScript.

View 3 Replies View Related

JQuery :: Display A Word Document Inside A UI Dialog?

Jul 7, 2011

Is it possible to display a word document inside a JQueryUI dialog?

View 1 Replies View Related

Get MS Word Document Page Settings And Number Of Pages?

Aug 24, 2009

I need a suggestion or code in JavaScript which reads the MS Word document page settings and number of pages. I know how to open and read a MS Word document, but i couldn't able to get page properties.

View 1 Replies View Related

Syntax - Hidden Input Form Field Value Equal To Document.getElementById?

Apr 14, 2009

I have a draggable marker on my page that sets the value of a javascript variable when the marker is released.I want to submit this value to store it in a database however I cannot figure out how to pass this javascript variable as a hidden form field.Here is my code. I suspect this is completelyhow to make this "lat" value available to me after the form has been submitted.

Code:
<form name="myform" method="post" action="" >
<input type="hidden" name="lat" id="lat"

[code].....

View 2 Replies View Related

Document.write Output Won't Stay Inside Div / Get Values To Word-wrap When They Get To End Of Container?

Jun 21, 2010

I want to use document.write to output the values of an array. If the array is too long, it totally ignores the width of the container div. How do I get the values to word-wrap when they get to the end of the container?

I've searched on this forum, and also googled for the answer but can't find a solution. I'm still fairly new to Javascript.

View 4 Replies View Related

Encrypting JS Code On Wscript

Jul 20, 2005

Is it possible to encrypt/protect a source code of Javascript to be
run on WSCRIPT (not on a webpage)?

View 1 Replies View Related

WScript.Shell Problem

Jan 31, 2007

Trying to open a file on a network drive when user clicks an HTML button on a web page. When page loads, there is an error that states there's an invalid character on the line where I declare my variable. When I click the button, the error changes to "Object expected" but is on a line nowhere near any scripting or any HTML code related to scripting. Does my code look correct or no?

And, yes my button is calling the function on the "onclick" and "filepath" from VB code does have a value when I do a view source on the page.

<script language="javascript" type="text/javascript">
function OpenFile(){
var x = new ActiveXObject("WScript.Shell");
x.run(<%=filepath %>);
}
</script>

View 11 Replies View Related

Creating A XML Document Inside A Class

Jun 23, 2006

Im trying to set up a XML document object within a class declaration(mozilla only):

MyClass.prototype.loadXML = function(file)
{
this.isLoaded = false;
this.xml = document.implementation.createDocument("","",null);
this.xml.onload = this.fileLoaded;
this.xml.load(file);}

MyClass.prototype.fileLoaded()
{
this.isLoaded = true;}

Somehow, the isLoaded property doesnt seem to be set to true when i
create an instance of the class. I tryied passing the object instance
through an argument
...
this.xml.onload = this.fileLoaded(this)
...
MyClass.prototype.fileLoaded(obj){
obj.isLoaded = true;}

but i get even weirder results. Any ideas?

View 1 Replies View Related

Creating Canvas With Document.CreateElement?

Feb 25, 2010

Why doesn't the following code work:
<script type='text/javascript'>
var canvas = document.createElement('canvas');
canvas.width = 1400;
canvas.height = 700;
var context = canvas.getContext('2d');
context.strokeRect(10, 10, 50, 50);
context.stroke();
</script>

View 4 Replies View Related

JQuery :: Creating Function Based On Text Argument

Oct 21, 2009

All the function extending I see extends on an _object_. I want to extend on a string.
/**
* Returns a slug version of a string
*/
jQuery.extend ({
slug: function( text ) {
return text.trim().toLowerCase().replace( /[^-a-zA-Z0-9s]/g,'' ).replace( /[s]/g, '-' );
}});
I want to be able to do something like:
$('#form_element').val().slug();
The above does not work. I even tried modifying the 'trim' function in jQuery core to include the rest of the enhancements, but it didn't work.

View 2 Replies View Related

Creating Square Bullets Based On A Status Column?

Nov 19, 2010

I am adding code to a SharePoint 2007 list where I want a calculated field to be a colored square based on a status column.I have all the code I need to create a colored round bullet, but I would like the bullet to be square or a rectangle.I was not able to find a repalcement for the "bull" in the below code.

arr[i].innerHTML = "<DIV title='Long Term Focus' style='font-weight:bold; font-size:24px; color:green'>•</DIV>";

View 5 Replies View Related

Thru Window.open Open A Word Document In Print Preview Mode

Jul 23, 2005

Through window.open or window.showmodaldialog, I want to open a word
or excel document in Print Preview mode. Bcos I don't want the user to
make any changes or save it but the user can ONLY VIEW OR take a print
out.

View 1 Replies View Related

JQuery :: Passing Document Context When Creating An Element?

Dec 29, 2010

Is there any way to pass the document context when doing a create element? If I have an iframe defined as follows..

var f = window.frames.myIframe;
How can I do this in jquery?
var d = f.document.createElement("div");

[code]....

View 1 Replies View Related

Creating A Form That Will Change The Number Of Fields Based On User Input

Jan 4, 2006

I have a form that collects information about up to 5 items. I would
like the user to be able to select from a drop down menu how many items
for which they want to compare information, and then have the form
change the number of input fields accordingly.

In other words, if the user selects enter info for 3 items, then input
fields for only 3 items are shown, if they change it to 4 items, then a
fourth column shows up in the table with the appropriate input fields.

View 2 Replies View Related

Get The Search Word - Find A Word Inside A String

Jun 15, 2011

I am trying to find a word inside a string.the search his going fine but I need to know which word has been found in the string.

Code:

Code:

Now in the string only one value can be found at a time.So its either a1 or a2 or so on.....

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved