Results 1 to 7 of 7

Thread: Javascript instantiate COM object?

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2004
    Posts
    52

    Javascript instantiate COM object?

    Hi everyone,

    I have a IE web site that needs to use a series of DLL files
    loaded on the client machine.

    I know that an activeX can call the objects,
    but we are talking about having javascript instantiate and use the
    functions in the DLL.

    This might be in the wrong forum - sorry if it is.

    thanks
    tony

  2. #2
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Javascript instantiate COM object?

    Can JavaScript use the CreateObject command?
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2004
    Posts
    52

    Re: Javascript instantiate COM object?

    if i knew the answer, then i guess i wouldn't have needed to post the questions -

    god i hate people that answer a friggin question with another question



    GFO

  4. #4
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Javascript instantiate COM object?

    Does that include me?
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Javascript instantiate COM object?

    Quote Originally Posted by pithhelmet
    if i knew the answer, then i guess i wouldn't have needed to post the questions -

    god i hate people that answer a friggin question with another question



    GFO
    You'll get absolutely nowhere with an attitude like that. We're trying to help you, so cool it.

  6. #6

    Thread Starter
    Member
    Join Date
    Nov 2004
    Posts
    52

    Re: Javascript instantiate COM object?

    you are correct - i need to cool it

    GFO

    and

    GFY

  7. #7
    New Member
    Join Date
    Apr 2006
    Posts
    4

    Re: Javascript instantiate COM object?

    yes, you can, provided the object exists on the server if running from a webpage (unless it's a .HTA application, in which object on client is ok?).

    Here's a syntax example:

    myObj = new ActiveXObject("Word.Application");

    then use it the same way as with VBScript. But remember methods must be called with () like myObj.myMethod(args); and don't forget the semicolon at the end.

    You can also perform error/exception handling of the COM object by using a try/catch block in javascript on the object method in question, etc. like

    try{
    myObj.mymethod();
    }catch(err){
    //handle error here
    }

    I find this kind of COM error handling much more effective than when using VBScript to do the equivalent (which lacks the extra error handling features of VB).
    Last edited by daluu; Apr 21st, 2006 at 06:11 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width