Highlighted

Scripting Styles keyboard shortcuts

New Here ,
Jul 14, 2011

Copy link to clipboard

Copied

Hi.

I'm creating an Applescript for Indd 5.5 that will create a number of documents and add them to a book file. I'm trying to flesh out all the book's documents with as many text and object styles as I can, and ensure each document has only the swatches etc. needed for the book.

I've managed to create text styles and groups (folders) quite easily, but I can't find a way of assigning a keyboard shortcut to a style. Typically, I will be using shortcuts on the numeric keypad, and using the command key (Mac) – Command+Num 8, for example. I've searched the web, but can't find anything that shows how to do it – only how to assign global shortcut sets for InDesign.

Can anyone point me in the right direction?

Thanks,

K@

Topics

Scripting

Views

740

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

Scripting Styles keyboard shortcuts

New Here ,
Jul 14, 2011

Copy link to clipboard

Copied

Hi.

I'm creating an Applescript for Indd 5.5 that will create a number of documents and add them to a book file. I'm trying to flesh out all the book's documents with as many text and object styles as I can, and ensure each document has only the swatches etc. needed for the book.

I've managed to create text styles and groups (folders) quite easily, but I can't find a way of assigning a keyboard shortcut to a style. Typically, I will be using shortcuts on the numeric keypad, and using the command key (Mac) – Command+Num 8, for example. I've searched the web, but can't find anything that shows how to do it – only how to assign global shortcut sets for InDesign.

Can anyone point me in the right direction?

Thanks,

K@

Topics

Scripting

Views

741

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
Jul 14, 2011 0
LEGEND ,
Jul 14, 2011

Copy link to clipboard

Copied

So, this is the second time this week I am going to propose a solution I've never used to solve a problem.

This is kind of a dangerous habit.

It appears that this is an omission from the scripting DOM, and there is no direct way to do this with scripting.

You can do it with IDML/snippets, though.  Construct a paragraph style in IDML XML and save it as a snippet:

<ParagraphStyle
  Self="ParagraphStyle/test"
  Name="test"
  Imported="false"
  NextStyle="ParagraphStyle/test"
  KeyboardShortcut="16 103"
  PointSize="8"
>

making sure to set the KeyboardShortcut attribute appropriately. Then place the snippet. Then you can modify the attributes of the style in the scripting DOM.

Let me know if this actually works...

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 14, 2011 1
New Here ,
Jul 14, 2011

Copy link to clipboard

Copied

Thanks John.

I'll try that out ASAP.

K@

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 14, 2011 0
New Here ,
Jul 14, 2011

Copy link to clipboard

Copied

Ok, I've tried it out and it does work.

However, the easiest way for me to create the IDML is to make a dummy .indd with the styles and shortcuts, create a frame with refs to each style that has a shortcut, then import via AppleScript – which sort of negates the ease of putting the shortcuts into the AppleScript code. It does mean that I wouldn't need to format the style within the script, but I'd be reliant on an external file to get the shortcuts, and (as I'm no XML expert), a 'master' .indd with the styles already setup in it.

Still, it's a definite solution, and I may use this method once I've polished off other areas. Of course, it also depends on whether our Production Dept. will even use the shortcuts I assign!

Thanks again John: most helpful.

K@

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 14, 2011 0
LEGEND ,
Jul 14, 2011

Copy link to clipboard

Copied

Well, I was proposing a slightly different strategy.

Export one style from the INDD to IDMS, and then delete

all the extra crap that is not the style definition. That

leaves you with about 20 lines of XML.

Then, write your AppleScript to create a 20-line XML file

containing those literal 20 lines, while adjusting the name

and shortcut of the style.

Then your Applescript can place the IDMS snippet file after it

writes it, and then delete the temporary file. You can then

modify the attributes of that imported paragraph style

in our script.

That's a little bit clunky but it shouldn't keep you from putting the

shortcuts in your applescript code. You are just dynamically

generating IDMS/IDML/XML from your applescript.

You mention maybe you would prefer not to format the style within

the script? Well, then I guess you have even more options

available!

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 14, 2011 0
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