Yes I did. It produced the variant type unknown error as described in the
first post.

import win32api
import win32com.server.util
from win32com import client as w32Client

win32Client =
win32com.client.gencache.EnsureDispatch("{69072C2D-6ED1-4051-BF8D-70286A303CDD}")

s = "AL"
r = "On"

win32Client.scriptCmd(s,r)
Traceback (most recent call last):

  File "<ipython-input-7-b7dc7ecf5817>", line 1, in <module>
    win32CC.scriptCmd('s','n')

  File
"C:\Users\Natchos\AppData\Local\Temp\gen_py\3.8\E07C24C7-56CE-409F-AB60-DC7EDE9D9888x0x1x0.py",
line 37, in scriptCmd
    return self._oleobj_.InvokeTypes(216, LCID, 1, (3, 0), ((31, 1), (31,
1)),cmd

TypeError: The VARIANT type is unknown (0x0000001f)

I did mange to find a workaround using another package(comtypes) and
working with ctypes:

from comtypes import client as ctClient
import comtypes
import ctypes

AutoIPam = ctClient.CreateObject("ImagingWin.AutoIPam")
s = ctypes.c_wchar_p(cmd)
r = ctypes.c_wchar_p(param)
AutoIPam.scriptCmd(s,r)

This version does work and does not throw an error. I can confirm the
instrument responds to the commands sent thusly.

On Tue, Jan 26, 2021 at 7:47 PM Tim Roberts <t...@probo.com> wrote:

> Olle Pontén wrote:
> >
> > Hmm ok, I could find the following information using OLEView (se
> > attachment).
> > It states that the two in parameters are noted as VT_LPWSTR for the
> > scriptCmd command.
> > Would that mean that I have no way of interfacing with them at all?
>
> No, it doesn't mean that!  If it doesn't ask for a variant, then you
> don't deliver a variant.  Did you try just passing a string, as Mark
> suggested?
>
> --
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
>
>
> _______________________________________________
> python-win32 mailing list
> python-win32@python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to