Apple script for line height multiple?

#1

Does anyone know if you can use Apple Script to set the “line height multiple” for text? (highlighted below)

44%20PM%201

#2

That’s not (yet) possible. Only baseline offset, tail/head indent, first line head indent, minimum/maximum line height and line/paragraph spacing can be set.

#3

That’s what I thought. I was hoping to write a script to more quickly set my standard note-taking text style, which has been using this spacing.

There’s no way in Apple Script to apply a saved style (one of the named favorites) to text, is there?
(e.g. set properties to { style: heading } )

#4

No, styles are internally handled by macOS’ text engine. Wouldn’t a template work?

#5

Sure, but I often have old docs I need to reformat. I was thinking of just putting a couple text formatting apple scripts in the main tool bar for quick one-click convenience.

(Also just trying to learn a little more Apple Script, which is I find utterly confusing.)

#6

There is a way around this (at least in DT Pro Office 2, I haven’t transitioned to DT3 yet). The styles listed in the little drop down menu alongside alignment, spacing and list properties can be given keyboard shortcuts. You can do this going to System Settings > Shortcuts > App Shortcuts and adding a shortcut with the name of the style for your version of DEVONthink.

If you did this correctly, the keyboard shortcut should then appear in the little menu, too:
10

If you wanted to fully automate this, you could then get an AppleScript to simulate those key presses, like this (if you use a different shortcut, the second line would need to be changed accordingly):

tell application “System Events”
keystroke “a” using command down
keystroke “<” using {control down, command down}
end tell

#7

Thanks, that is easier. As long as the Format bar is visible, of course.

Sometimes those keybard shortcuts can be finicky about the menu syntax — didn’t think to just try the style name!