Skip to main content
Known Participant
April 27, 2020
Answered

How to switch off SuperScript in InDesign

  • April 27, 2020
  • 6 replies
  • 2835 views

Hi, 

How can I switch off SuperScript in VB ? 

AdobeInDesignApp.ChangeTextPreferences.Superscript = False is now working

 

 

This topic has been closed for replies.
Correct answer Manan Joshi

The following code works for me 

Set myInDesign = CreateObject("InDesign.Application")
myInDesign.FindTextPreferences = idNothingEnum.idNothing
myInDesign.ChangeTextPreferences = idNothingEnum.idNothing
myInDesign.FindTextPreferences.FindWhat = "0000"
myInDesign.ChangeTextPreferences.Underline = False
myInDesign.ChangeTextPreferences.Position = idPosition.idNormal
myInDesign.Documents.Item(1).ChangeText
myInDesign.FindTextPreferences = idNothingEnum.idNothing
myInDesign.ChangeTextPreferences = idNothingEnum.idNothing
myInDesign.FindTextPreferences = idNothingEnum.idNothing
myInDesign.ChangeTextPreferences = idNothingEnum.idNothing

 

The issue was that you were using the wrong enum for normal, it was popping an error for the same which i fixed and it worked.

 

-Manan 

6 replies

Manan JoshiCommunity ExpertCorrect answer
Community Expert
April 30, 2020

The following code works for me 

Set myInDesign = CreateObject("InDesign.Application")
myInDesign.FindTextPreferences = idNothingEnum.idNothing
myInDesign.ChangeTextPreferences = idNothingEnum.idNothing
myInDesign.FindTextPreferences.FindWhat = "0000"
myInDesign.ChangeTextPreferences.Underline = False
myInDesign.ChangeTextPreferences.Position = idPosition.idNormal
myInDesign.Documents.Item(1).ChangeText
myInDesign.FindTextPreferences = idNothingEnum.idNothing
myInDesign.ChangeTextPreferences = idNothingEnum.idNothing
myInDesign.FindTextPreferences = idNothingEnum.idNothing
myInDesign.ChangeTextPreferences = idNothingEnum.idNothing

 

The issue was that you were using the wrong enum for normal, it was popping an error for the same which i fixed and it worked.

 

-Manan 

-Manan
smolar22Author
Known Participant
April 30, 2020

 

Manan you are the best expert it works 🙂 

I have one more questions, also in this code we have : 

AdobeInDesignApp.Documents.Item(1).TextFrames.Item(i).contents = Replace(AdobeInDesignApp.Documents.Item(1).TextFrames.Item(i).contents, "000", Price_for_Item_No_From_Sheet)

and it is a problem, that if I used formatiing like above and then update TextFrames Contents it seems that AdobeInDesignApp.Documents.Item(1).TextFrames.Item(i).contents is it not updated or saved and it is wron formatting ? Maybe you have idea how to do that, becuase it

look for whole document not only this textframes which I want to update. so it is a huge problem for me. 

myInDesign.FindTextPreferences.FindWhat = "0000"
myInDesign.ChangeTextPreferences.Underline = False
myInDesign.ChangeTextPreferences.Position = idPosition.idNormal
myInDesign.Documents.Item(1).ChangeText

 

smolar22Author
Known Participant
April 30, 2020

I mean 

               AdobeInDesignApp.FindTextPreferences = idNothingEnum.idNothing
                AdobeInDesignApp.ChangeTextPreferences = idNothingEnum.idNothing

                AdobeInDesignApp.FindTextPreferences.FindWhat = AdobeInDesignApp.Documents.Item(1).TextFrames.Item(i).contents
                AdobeInDesignApp.ChangeTextPreferences.FontStyle = "Regular"
                AdobeInDesignApp.ChangeTextPreferences.PointSize = 9
                 AdobeInDesignApp.ChangeTextPreferences.Leading = 10.8
                AdobeInDesignApp.Documents.Item(1).ChangeText
                
               AdobeInDesignApp.FindTextPreferences = idNothingEnum.idNothing
               AdobeInDesignApp.ChangeTextPreferences = idNothingEnum.idNothing

after this I am doing some replacement like : 

    AdobeInDesignApp.Documents.Item(1).TextFrames.Item(i).contents = AdobeInDesignApp.Documents.Item(1).TextFrames.Item(i).contents + "a1"
          

and it agains give me wrong formatting. So someting like not saved 😞 

Community Expert
April 30, 2020

I tried a translation of your code in JS on the dicument you supplied and i see you have used properties in changeTextPreferences that don't exist. You should have got a code crash, if you had told that we could have figured this out early. Removing these lines the code works. Remove the following line from your code and see if it works or not

//app.changeTextPreferences.superscriptPosition = 0
//app.changeTextPreferences.superscriptSize = 0
//app.changeTextPreferences.smartTextReflow = false
//app.changeTextPreferences.typographerQuotes = false
//app.changeTextPreferences.useOpticalSize = false
//app.changeTextPreferences.useParagraphLeading = false
//app.changeTextPreferences.zOrderTextWrap = false

 -Manan

-Manan
smolar22Author
Known Participant
April 30, 2020

HI, you can see that in code I have it commented, so it is not used in code 😞

I think it is not a cause 😞 

Jongware
Community Expert
Community Expert
April 30, 2020

You can help Manan help you by supplying as much useful information as possible...

"There is a problem" may be a perfectly correct description of what you are seeing but it doesn't really tell us anything useful at all.

Community Expert
April 28, 2020

Give me a sample InDesign document, upload it on dropbox or similar cloud service and paste the public link here. I will have a look and see if i can spot the issue

 

-Manan

-Manan
smolar22Author
Known Participant
April 30, 2020

Here you can find inDesign file and excel with Macro 

 

Please let me know or maybe send email to you or different contact so I can show you more details/

There is a problem with removing SuperScript

Community Expert
April 28, 2020

Did you try to debug the issue as i mentioned, were you able to find or change the superscript using the Find/Change dialog with the same settings that you are using from the script?

Can you share the InDesign document which has this issue? Also is there any specific reason to use VBScript, JS would work on both a MAC as well as WIN machine

 

-Manan

-Manan
smolar22Author
Known Participant
April 28, 2020

I am using VBA excel, so in Debug I can only see on Adobe InDesing in realtime. 

So as I mention, Underline is removing correctly from InDesign, but SuperScript is not working. Nothing is changing.

I am using VBA Excel, because input data are in Excel - prices to udpate which comes from another tool ( it is exported to excel) so it is why I am using. So as I mentiond Underline=False causes removing underling from text in InDesign, so it is working, only problem with this position. Do you need something more ? 

                    AdobeInDesignApp.FindTextPreferences = idNothingEnum.idNothing
                    AdobeInDesignApp.ChangeTextPreferences = idNothingEnum.idNothing
                    AdobeInDesignApp.FindTextPreferences.FindWhat = 
                    AdobeInDesignApp.Documents.Item(1).TextFrames.Item(ix).contents

                    AdobeInDesignApp.ChangeTextPreferences.Underline = False
                    AdobeInDesignApp.ChangeTextPreferences.Position = Position.Normal
     
                    AdobeInDesignApp.Documents.Item(1).ChangeText
                    AdobeInDesignApp.FindTextPreferences = idNothingEnum.idNothing
                    AdobeInDesignApp.ChangeTextPreferences = idNothingEnum.idNothing
                

 

Community Expert
April 27, 2020

I don't have access to a WIN machine to verify the code you shared, i have an idea that could help you debug the issue. Run your code with the last two lines commented out, specifically the lines given below

AdobeInDesignApp.FindTextPreferences = idNothingEnum.idNothing
AdobeInDesignApp.ChangeTextPreferences = idNothingEnum.idNothing

What this will do is keep the find/change setting your applied still persisted. After that you can open the Find/Change dialog and see if all properties are set as you desired, then you can even run the change using the dialog to see if these settings indeed does find something.

 

-Manan
smolar22Author
Known Participant
April 27, 2020

Hi, I am using it.

 

I also have in script to remove Underline and it is working correctly.

 

AdobeInDesignApp.FindTextPreferences = idNothingEnum.idNothing
AdobeInDesignApp.ChangeTextPreferences = idNothingEnum.idNothing 
AdobeInDesignApp.ChangeTextPreferences.Underline = False
AdobeInDesignApp.ChangeTextPreferences.Position = Position.Normal
AdobeInDesignApp.Documents.Item(1).ChangeText
AdobeInDesignApp.FindTextPreferences = idNothingEnum.idNothing
AdobeInDesignApp.ChangeTextPreferences = idNothingEnum.idNothing

 

Only problem with SuperScript

Community Expert
April 27, 2020

What do mean by switiching off the superscript. Do you want to remove superscript on a text that you found using the find/change feature? If that is so then you are targetting the wrong property, there is no property named superscript, but it is postion that can be set to superscript or any other permissible value with normal being the one that will make the text as normal. Look at the following for description on all the properties in the changeTextPreferences object

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#ChangeTextPreference.html

 

So the code that should work for you would be something like

 

AdobeInDesignApp.ChangeTextPreferences.position = Position.NORMAL

 

 P.S. :- I don't have access to a WIN machine so please verify the case of the property and enumeration as it works in VB

 

-Manan
smolar22Author
Known Participant
April 27, 2020

HI, this code 

   AdobeInDesignApp.ChangeTextPreferences.Position = Position.NORMAL

is not working 😞 I mean it is not removing SuperSript ;(  

Do you have different option?