1 person found this helpful
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...
I'll try that out ASAP.
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.
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