• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
Jun 06, 2020 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

TOPICS
Scripting

Views

626

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
community guidelines

correct answers 1 Correct answer

Guru , Jun 07, 2020 Jun 07, 2020

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

Votes

Translate

Translate
Guru ,
Jun 07, 2020 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

Votes

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
community guidelines
Explorer ,
Jun 08, 2020 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.

Votes

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
community guidelines
Guru ,
Jun 09, 2020 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

Votes

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
community guidelines
Explorer ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines