Jump to content


Photo
- - - - -

Automating Bartender Via Dcom

COM DCOM VBScript remote automation

  • Please log in to reply
11 replies to this topic

#1 yca

yca

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 08 July 2016 - 05:37 AM

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?

#2 Ian C - BarTender ninja @ Seagull

Ian C - BarTender ninja @ Seagull

    Technical Services Specialist, EMEA

  • Administrators
  • 2,821 posts
  • LocationMadrid

Posted 11 July 2016 - 01:15 AM

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



#3 yca

yca

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 11 July 2016 - 01:26 AM

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
---------------------------


#4 Ian C - BarTender ninja @ Seagull

Ian C - BarTender ninja @ Seagull

    Technical Services Specialist, EMEA

  • Administrators
  • 2,821 posts
  • LocationMadrid

Posted 11 July 2016 - 01:35 AM

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")



#5 yca

yca

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 11 July 2016 - 02:48 AM

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.

#6 yca

yca

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 11 July 2016 - 02:50 AM

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

#7 Ian C - BarTender ninja @ Seagull

Ian C - BarTender ninja @ Seagull

    Technical Services Specialist, EMEA

  • Administrators
  • 2,821 posts
  • LocationMadrid

Posted 11 July 2016 - 03:02 AM

We don't support DCOM.



#8 yca

yca

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 11 July 2016 - 03:08 AM

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.

#9 Ian C - BarTender ninja @ Seagull

Ian C - BarTender ninja @ Seagull

    Technical Services Specialist, EMEA

  • Administrators
  • 2,821 posts
  • LocationMadrid

Posted 11 July 2016 - 03:23 AM

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.



#10 yca

yca

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 11 July 2016 - 03:55 AM

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).

Attached Thumbnails

  • Untitled.png


#11 yca

yca

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 11 July 2016 - 04:01 AM

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.



#12 yca

yca

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 12 July 2016 - 04:09 AM

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}"






Also tagged with one or more of these keywords: COM, DCOM, VBScript, remote, automation

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users