I am a complete beginner myself with python and win so surely there are better ways of doing this. In any case, here's my try. You could try to go in the reverse manner: instead of trying to guess the right way from python to VB, define an Array object in VB and pass it to python, dispatch it if needed, and look at how it is formed. In this way you will find out precisely how the array object is formed.
francesco On 5/1/07, Sam The Cat <[EMAIL PROTECTED]> wrote:
Help ! I am writing some COM code in Python to control photoshop. Several functions of PS require an "Array" argument. In the examples of VBscript or javascript the Array type is used. I have tried what would appear to be the equivalent in Python -- Lists and Tuples -- but to no avail. Anyone have any insight on what via the COM interface is equivalent to an Array in javascript ? Here is the Javascript example code ..... selRegion = Array(Array(1,1),Array(1,2),Array(2,2),Array(2,1)) Doc.Selection.Select(selRegion,1,0,0) ..... Here is my interpretation in Python ....... selregion = [(1,1),(1,2),(2,2),(2,1)] print selregion doc.Selection.Select(selregion,1,0,0) ...... Here is the error code generated .......... F:\automation>test2.py [(1, 1), (1, 2), (2, 2), (2, 1)] Traceback (most recent call last): File "F:\automation\test2.py", line 19, in ? doc.Selection.Select(selregion,1,0,0) File "<COMObject <unknown>>", line 3, in Select pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Adobe Photoshop', 'Illegal argument - argument 1\n- Only arrays with dimension 1 are supported', None, 0, -2147220262), None) ............ I have tried many differnet permutations of structure for the selregion variable. Any scalar or single dimension array returns an "Illegal Argument" response with no further details -- any thing that resembles a two dimensional array returns the result above. Any help / thoughts would be appreciated _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32
-- "Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose vis-à-vis an introduction, so let me simply add that it's my very good honor to meet you and you may call me V." -- V's introduction to Evey
_______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32