--- In [email protected], "Sheri" <sheri...@...> wrote:
>
> This line should certainly work:
> appRef.Select(appRef.ActiveDocument.TextFrames.Item(5))
Above has two invokes with existing VARIANT arguments, a Select method and an
Item get property.
The Item get property should be returning an object.
The Select method's VARIANT input in this invocation should be the object
gotten.
Using COMplugin0.72_100121
plugin services should not be affected by set_arg_types. Currently
get_object_description no longer works if preceded by a set_arg_types
e.g.
com.set_arg_types("lv",1)
win.debug(appRef.ActiveDocument.TextFrames.get_object_description("fdnpt",
"Item"))
Error dialog shows
Invalid use of period: cannot load plugin, invalid handle value, or invalid
function:
Error occurred near line 25 of script F8951940:
win.debug(appRef.ActiveDocument.TextFrames.get_object_description("fdnpt",
"Item"))
FYI without the set_arg_types this:
win.debug(appRef.ActiveDocument.TextFrames.get_object_description("fdnpt",
"Item"))
Debugs:
TextFrames
Text Frames
get property: IDispatch* = Item(IN VARIANT index) (DEFAULT)
Following works in COMplugin0.72_100121
local myselect= ;;+
appRef.ActiveDocument.TextFrames.get_property_typed("Item", ;;+
"iv", 5)
win.debug("i", com_status, com_type)
Also works with "lv" instead of "iv", btw.
Same expectation for dot syntax fails:
com.set_arg_types("iv",1)
local myselect=appRef.ActiveDocument.TextFrames.Item(5)
---------------------------
PowerPro
---------------------------
Invalid use of period: cannot load plugin, invalid handle value, or invalid
function:
Error occurred near line 37 of script xxxxx:
local myselect=appRef.ActiveDocument.TextFrames.Item(5)
Press Cancel to end all running scripts.
---------------------------
OK Cancel
---------------------------
com_status is nonetheless "OK". Per the itypeinfo shown it should be returning
an object, IDispatch*:
get property: IDispatch* = Item(IN VARIANT index) (DEFAULT)
When using get_property_typed, the com_type is Text Frame. In dot format, no
com_type is returned.
Regarding guessing, ...
Some methods with VARIANT input can accept either a string or number, but if
its a number, needs to be treated as a number. So should not be guessing string
for a number. A handle to an object also should not be guessed to be a string.
This error shows that the com plugin handle is being sent as a string when
guessing is in effect:
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".
When guessing is turned on, and you invoke a method with no arguments
specified, no VARIANTs should be sent for any optional parameters. I think if
there is a persistant set_arg_types in effect, it may now be sending VARIANT
formatting empty strings.
IMO there should be one good guess if there is no typespec in effect. If
typeinfo for the method or property is specific, the specific type. Otherwise,
the guess should be driven by the content of the arguments. We should have a
way to designate booleans, maybe "~TRUE~" and "~FALSE~". Numbers are numbers.
Objects are objects. Unicode handles are strings. If none of the above, string.
If multiple guessing is enabled, there should only be multiple invokes if you
know which parameter is in error. Do not arbitrarily send all strings.