Highlighted

Removes Shortcut keys assign to ParagraphStyles

Engaged ,
Jun 28, 2019

Copy link to clipboard

Copied

Hi All,

Is there any options Removes Shortcut keys assign to Stylesheets.

I have attached before and after screenshots below:

Screen Shot 2019-06-28 at 1.42.10 PM.png     Screen Shot 2019-06-28 at 1.41.26 PM.png

Thanks,

Prabu

TOPICS
Scripting

Views

352

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

Removes Shortcut keys assign to ParagraphStyles

Engaged ,
Jun 28, 2019

Copy link to clipboard

Copied

Hi All,

Is there any options Removes Shortcut keys assign to Stylesheets.

I have attached before and after screenshots below:

Screen Shot 2019-06-28 at 1.42.10 PM.png     Screen Shot 2019-06-28 at 1.41.26 PM.png

Thanks,

Prabu

TOPICS
Scripting

Views

353

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 28, 2019 0
Adobe Community Professional ,
Jun 28, 2019

Copy link to clipboard

Copied

There is no property on the DOM to access this information directly. Go through the following threads for some ideas on how you can do it

is it possible to assign a keyboard shortcut in a script to style

Re: Scripting Styles keyboard shortcuts

-Manan

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 28, 2019 0
Adobe Community Professional ,
Jun 29, 2019

Copy link to clipboard

Copied

Hi together,

you may have noticed that if you duplicate a paragraph style in the UI the keyboard shortcut will not be duplicated.

So I tried the following snippet:

/*

    Text selected where the applied paragraph style has a keyboard shortcut ( KBSC ).

    I want to get rid of the KBSC so I try to duplicate the style in the hope that the duplicate has no KBSC applied.

  

    Unfortunately that's not the case!

    The duplicate style has the same KBSC than the source.

    Something you cannot do with the UI.

  

*/

var sourceStyle = app.selection[0].appliedParagraphStyle ;

var sourceStyleName = sourceStyle.name ;

var tempStyle = sourceStyle.duplicate();

// Will not work as expected.

// The KBSC is still there:

sourceStyle.remove( tempStyle );

tempStyle.name = sourceStyleName;

Two paragraph styles with the same KBSC after running lines 11 to 13 of the code snippet above:

PROBLEM-Style.duplicate()-duplicates-KBSC.PNG

So we need a different solution.

With an edited IDMS file perhaps.

Regards,
Uwe

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 29, 2019 1
Engaged ,
Jul 01, 2019

Copy link to clipboard

Copied

Ananth@desgin, https://forums.adobe.com/people/Manan%20Joshi Lauender

I found that if you add new paragraph style(s) using "basedOn" the keyboard shortcut are not included.

In the script below the new temporary styles retain all the correct style properties/settings until the script removes and replaces the original styles. I guessing that's do to the fact that the "basedOn" styles have been removed and the new styles no longer have their reference.

How can we work out that issue?

  var doc = app.documents[0];

       function myGetParaStyles(){

      var myParaStyles = new Array;

       for (var i = 2; i < doc.paragraphStyles.length; i++){

       myParaStyles.push(doc.paragraphStyles.name);

 

     }

        return myParaStyles;

    }

  var myStylesToReplace = myGetParaStyles();

  var allParaStyles = app.activeDocument.allParagraphStyles;

   function myGetNewParaStyles(){

   var myNewParaStyles = new Array;

    for (var i = 2; i < allParaStyles.length; i++) {

    var curStyle = doc.paragraphStyles.itemByName(allParaStyles.name);

    var parastylesName = allParaStyles.name;

 

      var copyStyle= doc.paragraphStyles.add(allParaStyles);

      copyStyle.basedOn = curStyle;

      copyStyle.name = parastylesName + "-copy";

      curStyle = copyStyle;

      myNewParaStyles.push(copyStyle.name);

   

      }

        return myNewParaStyles;

    }

var myNewStyles = myGetNewParaStyles();

  try {

  for (var i = 0; i < myStylesToReplace.length; i++){

    for (var i = 0; i < myNewStyles.length; i++){

   doc.paragraphStyles.item(myStylesToReplace).remove(myNewStyles);

    }

}

   } catch(e) {}

  pstyles = app.documents[0].allParagraphStyles;

  for (i = pstyles.length-1; i > 1; i--) {

  pstyles.name = pstyles.name.replace(/\-copy/g,'');

}

Regards,

Mike

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...
Jul 01, 2019 0
FRIdNGE LATEST
Advocate ,
Sep 15, 2020

Copy link to clipboard

Copied

Surely too late but Just For Comment:

 

 

(^/)  The Jedi

 

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...
Sep 15, 2020 0