VB: Assigning to a Boolean property in Adobe Illustrator, Photoshop

放肆的年华 提交于 2019-12-10 20:04:01

问题


While automating Adobe Illustrator CS3 using VBA I discovered that assigning a Boolean variable to a Boolean property results in assigning False always:

Dim New_Path As Illustrator.PathItem
Dim v As Boolean
' ...
v = True
New_Path.Filled = v     ' ERROR: New_Path.Filled is False
v = False
New_Path.Filled = v     ' New_Path.Filled remains False

Assigning to a constant works fine:

Dim New_Path As Illustrator.PathItem
' ...
New_Path.Filled = True  ' New_Path.Filled is True
New_Path.Filled = False ' New_Path.Filled is False

Verified for various AI Boolean properties such as PathItem.Stroked, Layer.Visible etc.

Verified for Photoshop.ArtLayer.Visible.

Verified for VB6.

So, I feel that this behavior is common for Adobe Adobe Creative Suite products.

Is this a bug or a feature?


回答1:


Wrap the v variable with CBool() function.



来源:https://stackoverflow.com/questions/27482952/vb-assigning-to-a-boolean-property-in-adobe-illustrator-photoshop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!