• 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 switch off SuperScript in InDesign

Community Beginner ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

Hi, 

How can I switch off SuperScript in VB ? 

AdobeInDesignApp.ChangeTextPreferences.Superscript = False is now working

 

 

TOPICS
Bug , How to , InCopy workflow , Scripting

Views

2.0K

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

Community Expert , Apr 30, 2020 Apr 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 = i
...

Votes

Translate

Translate
Community Expert ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

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

 

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
Community Beginner ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

HI, this code 

   AdobeInDesignApp.ChangeTextPreferences.Position = Position.NORMAL

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

smolar22_0-1587985496929.png

Do you have different option? 

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
Community Beginner ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

Script is here : I want to remove SuperScript from text. Yes you are right. 

 

   AdobeInDesignApp.FindTextPreferences = idNothingEnum.idNothing
                    AdobeInDesignApp.ChangeTextPreferences = idNothingEnum.idNothing
                    AdobeInDesignApp.FindTextPreferences.FindWhat = "0000"
                  '  AdobeInDesignApp.ChangeTextPreferences.FontStyle = "Regular"
                  '  AdobeInDesignApp.ChangeTextPreferences.SuperscriptPosition = 0
                   ' AdobeInDesignApp.ChangeTextPreferences.SuperscriptSize = 0
                    AdobeInDesignApp.ChangeTextPreferences.Underline = False
                    AdobeInDesignApp.ChangeTextPreferences.Position = Position.NORMAL
             '       AdobeInDesignApp.ChangeTextPreferences.SmartTextReflow = False
               '     AdobeInDesignApp.ChangeTextPreferences.TypographerQuotes = False
                '    AdobeInDesignApp.ChangeTextPreferences.UseOpticalSize = False
                 '   AdobeInDesignApp.ChangeTextPreferences.UseParagraphLeading = False
                  '   AdobeInDesignApp.ChangeTextPreferences.ZOrderTextWrap = False
                    AdobeInDesignApp.Documents.Item(1).ChangeText
                    AdobeInDesignApp.FindTextPreferences = idNothingEnum.idNothing
                    AdobeInDesignApp.ChangeTextPreferences = idNothingEnum.idNothing

 

 

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
Community Expert ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

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.

 

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
Community Beginner ,
Apr 27, 2020 Apr 27, 2020

Copy link to clipboard

Copied

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

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
Community Expert ,
Apr 28, 2020 Apr 28, 2020

Copy link to clipboard

Copied

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

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
Community Beginner ,
Apr 28, 2020 Apr 28, 2020

Copy link to clipboard

Copied

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
                

 

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
Community Expert ,
Apr 28, 2020 Apr 28, 2020

Copy link to clipboard

Copied

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

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
Community Beginner ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

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

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
Community Expert ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

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

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
Community Beginner ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

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 😞 

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
Community Expert ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

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.

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
Community Expert ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

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 

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
Community Beginner ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

 

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

 

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
Community Beginner ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

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 😞 

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
Community Expert ,
Apr 30, 2020 Apr 30, 2020

Copy link to clipboard

Copied

In the latest snippet that you shared i see that you are searching the content of a textframe just to change its text property and then again changing its content. You could do it better this way,

  • First add all the content to textframe by setting the contents propery.
  • Then change its property like app.documents[0].textFrames[i].parentStory.pointSize etc

See the properties of the story object from the following link

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

 

I just gave you pointers you can convert the code snippet to equivalent VBS format. In my opinion there is no need to use Find/Change when you already know the textframe whose contents you need to process in totality

 

-Manan

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
Community Beginner ,
May 05, 2020 May 05, 2020

Copy link to clipboard

Copied

ok what do you mean by First add all the content to textframe by setting the contents propery.

 

Can you show mi sample or how to do that in correct way ? 

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
Community Beginner ,
May 05, 2020 May 05, 2020

Copy link to clipboard

Copied

LATEST

Hi, 

I changed to: 


AdobeInDesignApp.Documents.Item(1).TextFrames.Item(i).ParentStory.PointSize = 7
AdobeInDesignApp.Documents.Item(1).TextFrames.Item(i).ParentStory.Contents = Replace(AdobeInDesignApp.Documents.Item(1).TextFrames.Item(i).ParentStory.Contents, "Plecak", "dupdppppppapa")

 

and it works: First it changes this content to pointSize = 7, then update Contents and after that it again set wrong formatting (first it was 7 and 21 point size). Do you have any idea? 

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