Highlighted

How to specify "Unconditional" in Visual Basic (or vbscript)?

Explorer ,
Jun 06, 2020

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
TOPICS
Scripting

Views

305

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to specify "Unconditional" in Visual Basic (or vbscript)?

Explorer ,
Jun 06, 2020

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
TOPICS
Scripting

Views

306

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 06, 2020 0
Guru ,
Jun 07, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 07, 2020 2
Explorer ,
Jun 08, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 08, 2020 0
Guru ,
Jun 09, 2020

Copy link to clipboard

Copied

The code I posted works for me in InDesign 2020 (ver. 15.0.3) on Windows 10.

2020-06-10_08-14-48.gif

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2020 0
Explorer ,
Jun 09, 2020

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2020 1