Quantcast
Viewing latest article 18
Browse Latest Browse All 84

Adobe VBScript or COM API fails when Adobe application not already open on a certain machine

Was wondering if anybody might have input on this or observed this themselves. Is there a known issue/bug for this?

 

I'm building scripted tooling to automate tasks in Adobe Illustrator and Photoshop, using the COM API (what Adobe lists as VBScript scripting reference, but is really COM). I've tested with both JScript (Microsoft Javascript, for doing same things you would use VBScript for) and Python using COM. In both cases got the same issue.

 

When I was building the tooling, it works fine for me. But on a colleagues machine, the problem comes up. Sadly the error messaging is vague to pinpoint the root cause of the problem. We just know when it happens, but not why/how. We both have Windows 7 64-bit and are using 64-bit version of the Adobe apps, version CS6. Though we also have 32-bit version installed as well.

 

The funny thing about my colleague's machine is the the tool/script will execute fine if Adobe Illustrator/Photoshop is already open. But if the app is not open already, it just fails at the point of instantiating the COM object. On my machine it works fine in both cases.

 

Here's the error output observed:

 

in JScript

 

C:\scripts>cscript windows_cli_script_runner.js /s:C:\scripts\test.jsx

Microsoft (R) Windows Script Host Version 5.8

Copyright (C) Microsoft Corporation. All rights reserved.

 

 

 

C:\scripts\windows_cli_script_runner.js(25, 5) (null): 0x800700C1

 

 

 

 

in Python

 

C:\scripts>python cli_script_runner.py -s C:\scripts\test.jsx

cli_script_runner.py:33: SyntaxWarning: import * only allowed at module level

  def run_script(script,doc=None,app=None):

Traceback (most recent call last):

  File "cli_script_runner.py", line 89, in <module>

    run_script(args.script)

  File "cli_script_runner.py", line 68, in run_script

    app_ref = win32com.client.Dispatch(app)

  File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch

    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)

  File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName

    return (_GetGoodDispatch(IDispatch, clsctx), userName)

  File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch

    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)

pywintypes.com_error: (-2147024703, 'OLE error 0x800700c1', None, None)

 

 

 

C:\scripts>

 

basically both point to this line at failure:

 

in JScript

 

var app_ref = new ActiveXObject(app);

 

in Python

 

app_ref = win32com.client.Dispatch(app)

 

where app is "Illustrator.Application.CS6" or "Photoshop.Application", per the Adobe scripting guide and VBScript scripting reference.

 

I didn't test VBScript but assume it's the same since JScript and VBScript and Python are all using same COM interface, and VBScript and JScript using same Windows Scripting Host interface.


Viewing latest article 18
Browse Latest Browse All 84

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>