Copy link to clipboard
Copied
Can any one tell me how to specify "Unconditional" in Visual Basic (or vbscript)?
The code below is trying to set every text item to "Unconditional" text.
Dim myInDesign As InDesign.Application
myInDesign = CreateObject("InDesign.Application")
Dim myDocument As InDesign.Document
Dim myTextFrame As InDesign.TextFrame
Dim myText As InDesign.Text
For Each myDocument In myInDesign.Documents
For Each myTextFrame In myDocument.TextFrames
For Each myText In myTextFrame.Texts
myText.AppliedConditions = "[Unconditional]" ' <----- This line
Next
Next
Next
Try to apply an empty array as you did in JS here:
Function main()
Set myInDesign = CreateObject("InDesign.Application")
Dim myEmptyArray()
For Each myDocument In myInDesign.Documents
For Each myTextFrame In myDocument.TextFrames
For Each myText In myTextFrame.Texts
myText.AppliedConditions = myEmptyArray
Next
Next
Next
End Function
Copy link to clipboard
Copied
Try to apply an empty array as you did in JS here:
Function main()
Set myInDesign = CreateObject("InDesign.Application")
Dim myEmptyArray()
For Each myDocument In myInDesign.Documents
For Each myTextFrame In myDocument.TextFrames
For Each myText In myTextFrame.Texts
myText.AppliedConditions = myEmptyArray
Next
Next
Next
End Function
Copy link to clipboard
Copied
Thank you for your reply. Unfortunately, applying an empty array returns a COM exception error.
Below is the message. (The message itself is my translation. The original message is in Japanese.)
System.Runtime.InteropServices.COMException
HResult=0x0000770D
Message=The value of set property 'AppliedConditions' is invalid. The expected value is Array of Conditions, but value "nothing" was received.
Copy link to clipboard
Copied
The code I posted works for me in InDesign 2020 (ver. 15.0.3) on Windows 10.
Copy link to clipboard
Copied
Kasyan,
Thanks for your reply. I guess it works on vbs.
I run my scripts through "Visual Basic in Visual Studio" (via COM library), and it doesn't work there.
I should do everything in vbs, but I just can't stand the Adobe scripting environment (ExtendScript is it called?) I hear they discontinued it and moved onto Visual Studio Code plugin, but setting that up is a nightmare.
Thank you very much for your help.
Tak