本文介绍了VB:在Adobe Illustrator,Photoshop中分配给布尔属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用VBA自动化Adobe Illustrator CS3时,我发现将 Boolean变量分配给 Boolean属性会导致始终分配False:
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
已针对各种AI布尔属性(例如PathItem.Stroked
,Layer.Visible
等)进行了验证.
Verified for various AI Boolean properties such as PathItem.Stroked
, Layer.Visible
etc.
已通过Photoshop.ArtLayer.Visible
的验证.
已通过VB6验证.
因此,我认为这种行为在Adobe Adobe Creative Suite产品中很常见.
So, I feel that this behavior is common for Adobe Adobe Creative Suite products.
这是错误还是功能?
推荐答案
用 CBool()
函数.
这篇关于VB:在Adobe Illustrator,Photoshop中分配给布尔属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!