Jump to content
yca

Automating Bartender Via Dcom

Recommended Posts

yca

Hello there,

 

I am automating BarTender from VBScript from the machine where it is installed:

Set btApp = CreateObject("BarTender.Application")
btApp.Quit 1
Everything works fine.

Now I'm trying to run it from another machine:

Set btApp = CreateObject("BarTender.Application", "bartender.mydomain.local")
btApp.Quit 1
where "bartender.mydomain.local" is the network name of the machine where BarTender is installed.

I get the following message:

---------------------------
Windows Script Host
---------------------------
Script:	D:\Work\BarTender\test02.vbs
Line:	1
Char:	1
Error:	ActiveX component can't create object: 'BarTender.Application'
Code:	800A01AD
Source: Microsoft VBScript runtime error

---------------------------
OK   
---------------------------
What's wrong?
  • Like 3

Share this post


Link to post
Share on other sites
Ian C - BarTender ninja @ Seagull

You need to have BarTender installed on the local machine where your application is running.

Share this post


Link to post
Share on other sites
yca

Thank you!

 

Now I'm getting the following message:

---------------------------
Windows Script Host
---------------------------
Script: D:\Work\BarTender\test02.vbs
Line: 1
Char: 1
Error: Permission denied: 'CreateObject'
Code: 800A0046
Source: Microsoft VBScript runtime error

---------------------------
OK
---------------------------

Share this post


Link to post
Share on other sites
Ian C - BarTender ninja @ Seagull

Do you have BarTender installed on the same computer?  Is the installed BarTender activated as Automation edition or higher, or running as Trial within the trial period?  If no to both of these then that is why it is not working.  The second parameter in the CreateObject call should not be there.  It should only be: Set btApp = CreateObject("BarTender.Application")

Share this post


Link to post
Share on other sites
yca

You are wrong. The second parameter should be there, as long as I'm trying to run BarTender from another machine (as I wrote in the very first message).

 

Please see here:

Syntax

CreateObject(servername.typename [, location])
Arguments

servername

Required. The name of the application providing the object.

 

typename

Required. The type or class of the object to create.

 

location

Optional. The name of the network server where the object is to be created.

 

By the second argument, I am specifying the machine name where I actually want the Bartender.Application object to be created.

 

This technology is called DCOM, in contrast to what you are talking about, COM.

Share this post


Link to post
Share on other sites
yca

By the way, your previous advice helped me. Now I'm expiriencing some sort of permission issue.

Share this post


Link to post
Share on other sites
Ian C - BarTender ninja @ Seagull

We don't support DCOM.

Share this post


Link to post
Share on other sites
yca

What exactly do you mean:

 

1) The BarTender COM object does not support DCOM

or

2) You do not provide technical support about using the BarTender COM object in that way?

 

If (1), then you are wrong. The object doesn't even know than it is being created at the command of a process running on another machine. It is being created by the DCOM system on the local machine.

 

If (2), then it's a pity.

Share this post


Link to post
Share on other sites
Ian C - BarTender ninja @ Seagull

I believe that although theoretically possible, as you already allude to, assuming you overcome the permissions spider's web, but that there might still remain some BarTender specific reasons as to why this will not work as you hope.  I'm going from multi-year old memory here so cannot give precise details.

 

In any case, we don't provide technical support for this should you persist in trying.

Share this post


Link to post
Share on other sites
yca

I have succeeded!!!

 

Firstly, I added myself to Distributed COM Users security group on the target machine.
Secondly, on the target machine in dcomcnfg.exe at My Computer level, I gave all Launch and Activation Permissions to myself (see the attached screenshot).

post-43507-0-14013000-1468237962_thumb.png

Share this post


Link to post
Share on other sites
yca

The following code:

Set btApp = CreateObject("BarTender.Application", "bartender.mydomain.local")
MsgBox btApp.Version
btApp.Quit 1

outputs the following now:

---------------------------

---------------------------
9.01
---------------------------
OK   
--------------------------- 

9.01 is the BarTender version installed on the server (bartender.mydomain.local). The computer where I run the script from, has version 10.1 installed.

Share this post


Link to post
Share on other sites
yca

I've noticed that BarTender even doesn't have to be installed on client machine.

This small registry setting is enough:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Bartender.Application]

[HKEY_CLASSES_ROOT\Bartender.Application\CLSID]
@="{B9425246-4131-11D2-BE48-004005A04EDF}"

Share this post


Link to post
Share on other sites

×