Highlighted

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

Explorer ,
May 29, 2019

Copy link to clipboard

Copied

I am creating a couple of scripts to set up a set of basic styles for me to work with including adding the various attributes etc. The first script assigns a set of formats the current paragraph and then the second script creates the names of the style. So here is the code for creating body based on the current attributes: sel=app.selection[0]; newStyle=app.activeDocument.paragraphStyles.add(); newStyle.name="body"; newStyle.properties=sel.properties; This works great. However, I would like to be able to assign CTRL-numeric keypad 0 to this style within the script. Is this possible?

Topics

Scripting

Views

182

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

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

Explorer ,
May 29, 2019

Copy link to clipboard

Copied

I am creating a couple of scripts to set up a set of basic styles for me to work with including adding the various attributes etc. The first script assigns a set of formats the current paragraph and then the second script creates the names of the style. So here is the code for creating body based on the current attributes: sel=app.selection[0]; newStyle=app.activeDocument.paragraphStyles.add(); newStyle.name="body"; newStyle.properties=sel.properties; This works great. However, I would like to be able to assign CTRL-numeric keypad 0 to this style within the script. Is this possible?

Topics

Scripting

Views

183

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
Adobe Community Professional ,
May 29, 2019

Copy link to clipboard

Copied

Hi Raphaël,

unfortunately I see no property in the scripting DOM to do this.

But there is a chance to do this by a script.

For that you have to:

1. Export a text frame with the applied paragraph style to IDMS

2. Insert the keyboard shortcut in the XML of the IDMS file

3. Remove the paragraph style from the document

4. Place the IDMS snippet file with the new paragraph style

Here a sample XML excerpt from an exported IDMS file where I applied a keyboard shortcut for a paragraph style:

<

ParagraphStyle

Self="ParagraphStyle/KeyBoardShortCut"

Name="KeyBoardShortCut"

Imported="false"

NextStyle="ParagraphStyle/KeyBoardShortCut"


KeyboardShortcut="1 97"

>

If you are on Mac OS X the values could vary.

Did not find an explanation why value "1 97" actually means Cmd+Num 1 on my Windows 10 machine.

Another test with Cmd+Num 3 is showing the value "0 0"  for property KeyboardShortcut in the XML file.

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...
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...