--- In [email protected], "entropyreduction" 
<alancampbelllists+ya...@...> wrote:
> 
> --- In [email protected], "Sheri" <sherip99@> wrote:
> >
> > --- In [email protected], "entropyreduction" 
> > <alancampbelllists+yahoo@> wrote:
> 
>  
> > Invoke with all strings applies only to guessed parameters, and guessed 
> > parameters are only those that are VARIANTs in the typelib, Right??
> 
> Yes, no guessing if VT_VARIANT in typelib: or if you supply a
> typespec code for param.

I don't understand. I think you mean no guessing if typelib has specific types 
instead of VARIANT.

> 
> > > > Strings might be tricky <http://www.devguy.com/fp/Tips/COM/#BSTR>
> > > 
> > > I use I use ::SysAllocString(L""): CComBStr(L"foo") would destroy
> > > itself too soon.
> > 
> > Maybe that is because you had failed to copy it into a VARIANT using 
> > CComBStr.CopyTo !
> 
> In which case might as well just use SysAllocString.

My reading of the docs is, they warn against doing that very thing.
  
> 
> > Then when the BStr goes out of scope it will destroy itself, but
> > the cargo for the VT_BSTR will survive.

When a VARIANT with VT_BSTR no longer needs the length-prefixed-wide-string it 
sees as its cargo when the BStr has been properly created using CComBStr and 
properly planted in a VARIANT using CComBStr.CopyTo, the BStr cargo is 
automatically destroyed when the VARIANT is released.

> 
> COMplugin0.72_100121.zip: not much tested, but you can play.
> 
> added
> com.set_arg_types("guess")  
> com.set_arg_types("noguess")  
> config ini key guessArgTypes=1 (default 1)
> 
> If guessing on, on failure does the one-param-at-a-time thing if
> Invoke fails with DISP_E_PARAMNOTFOUND or DISP_E_TYPEMISMATCH,
> guesses at all that need it if its DISP_E_EXCEPTION. 

InDesign script is totally broken and now abysmally slow regardless of whether 
guessing is on or off.

This line should certainly work:
appRef.Select(appRef.ActiveDocument.TextFrames.Item(5))

with "guess", gets this error:

ERRORS: com.method: Invoke failed 
Error 770d:
from: C:\Program Files\Adobe\Adobe InDesign CS2\InDesign.exe
Invalid value for parameter 'SelectableItems' of event 'Select'. Expected 
Object, Array of Objects, idNothingEnum enumerator or idSelectAll enumerator, 
but received "c_3005".

with "noguess", gets this error:

ERRORS: com.method: Invoke failed 
Error 770b:
from: C:\Program Files\Adobe\Adobe InDesign CS2\InDesign.exe
The requested member of the collection does not exist.

The first invoke needs to be smarter. Is it sending VT_something for VARIANT 
arguments? Or is it not bothering with CComVariant?

Also, we've recently lost this error trapping, now its just letting it fly:

;referring to Excel ActiveSheet w no Workbooks open
local mysheet=xlapp.ActiveSheet
Jan 15 version com_status is ERRORS: com.method: Invoke failed 
Jan 18 version com_status is ERRORS: com.method: Invoke failed  (sys code 1: 
"Incorrect function.")
Jan 20 version com_status is "OK"
Jan 21 version com_status is "OK"

Regards,
Sheri

Reply via email to