Rather than using mouse-clics I want to 'call' text descriptions in a dropdown window!

I use Scrivener, and have succeeded with a few mostly mouse based macro. :slight_smile: but since I experience some curious results sometime, I wonder if it is possible to call/ address sub-options as in such a dropdown window.
The window "Paragraph Indents" is evoke by hotkey: option command '.
And I would like to set the specific value for 'First line' and 'Left' and 'Right'
Is it possible? and then how do I do it?



Hey GrayT,

Keyboard Maestro can't see those UI elements, but you could use the Click at Found Image action with an offset to get into the correct fields.

Alternatively you can use AppleScript UI-Scripting to get the job done.

Change the values as desired in the AppleScript action of the labelled code blocks that look like this:

# First Line
tell text field 1
   set its value to "1" <-- set your value here
end tell


Scrivener -- Set Tabs and Indents.kmmacros (7.5 KB)

Wauw, looks like I have gotten a true Swiss Armyknife, with KeyboardMaestro. Lots of possibilities. I dare not look into apple scripts too... you know suddenly you find yourself way off original focus. but I will keep in mind.
As of now 2 macros are working fine, one to go. (hit by the fact that deep in Scrivener there is one 'OK-button' not responding to 'Enter' so this one must be mouse clicked) ... I will persist and ind the end it WILL work :wink:
It is reassuring that members of this group (you) responds, Thank you so much.

The little persistent nag for me is that, by "tabbing" from input field to input field, and ALWAYS ending up in the 'top' field my keyboard entries, will land correct.... BUT if I for some reason use same function/ screen from inside the original app (scrivener) I may forget to return cursor to that field, and then the sequence goes haywire. It takes discipline, and sometimes I am just eager.... :slight_smile:


Hey GreyT,

Well – we try to prevent those hair-raising events with good automation practices.

You'll have to change the image in the Click at Found Image action, because the resolution of your Mac will be different than mine.

Click in the image-well and then hit the Spacebar to bring up Quick Look for the image.

You can use 4 to bring up the area-screenshot mechanism.

Hold down the Control key when you let go of the selected area (to make the image go to the Clipboard).

Paste into the image-well.

This will ensure your macro always starts in that first field.


Scrivener -- Set Tabs and Indents II.kmmacros (23 KB)

This looks intriguing... do I understand you correctly that I capture as picture to be recognised the word "Right" and then somehow determine how many steps to the right I need to end up in data field!
Never done that... is there a practical way to determine 'distance'? how many mm will an increment of 1 be?
I am amazed by all these possibilities for automation. And the few ones I have made is really freeing my fingers.... and the head spins in between.
just realised that your example is an actual macro and not only a screenshot
wauw... I'll look at it tomorrow


I have an iMac 27"-5K screen if that helps you give me a hint

Hey GreyT,


You want to capture more than just the word, because you need the uniqueness of the word on the colored background for the image-to-find.

I also made the image fairly wide, so my offset (in pixels) to the right wouldn't have to be too much.

Here's another macro where I've made the image even more unique, and I've specified that Keyboard Maestro search only in the front window for the image.

It's a bit faster and more robust.

As for screen measurements – I like this little app:


It will die after Mojave, because it's a 32-Bit app – but I'll keep using it until then. (Although I haven't seen how well it works on a Retina screen – yet.)

A simple way of figuring out where the action is clicking is:

Change the action to Just Move instead of click.

Disable other actions in your macro.

Run the macro with the Scrivener Tabs and Indents... sheet open, and WATCH where the cursor moves -- you can then adjust as necessary.


Scrivener -- Set Tabs and Indents III.kmmacros (32 KB)

ref: the Click at (xxx,yyy) part. I have discovered the benefit of "Go" and "Get" buttons, and the benefit of pointing to best/ correct window... sort of. I have also managed to grab and save Image, but I am still to succeed to point the correct offset from that Image! Thought I could use "Get" but then it became relative to window not Image.

A question: what is the difference by checking the box "Display" (or not).

Another question: Once I have captured an Image and saved it into the small area, can I let the system locate it on my screen?

When I run my macro (it fails in some connection to image) I can read the log but not really getting the message. I know there is a step by step debug option, but that does not make it clearer, for me.

Anyway. As it is now my macro's are working. Provided I keep my windows positions stable.
I am sure that I will get more understanding and knowledge "As time goes by"... and it takes lots of coffee :slight_smile:

One more thing :slight_smile:
At unexpected times, the macros went wild, that is, resulting click went astray.
In the end, after debugging, I realised that the "return home" clicks to main document in scrivener better be placed OUTSIDE the text area... turned out that som text being pasted had links that happen to fit the randomly placed returnpoint.
after I moved this point into the margin area, all goes to plan, again

Hey GreyT,

“Display” causes Keyboard Maestro to highlight the found image, so you can see what Keyboard Maestro sees.

Use it while developing and debugging your macro. Turn it off after you have a production macro.

Yes, but it's a good idea to HIDE the Keyboard Maestro Editor, because under some circumstances the macro will find the image in the image-well in addition to the image you want it to find.

I would think “return home” would better be done with a Bring Window to Front action, instead of a Click action.

In this particular macro you shouldn't have to do anything but dismiss the Paragraphs & Tabs sheet to return to the window you were working in – unless of course you've changed something.


Success :slight_smile:
Based on your input and input from Scrivener Support + true male persistence, I have managed to build macros that are not depending on specific placement of Scrivener window.
They are based almost solely on key-input, among such as found at "Navigate-Inspect-Notes” and "Navigate-Move focus to-Editor"
Except the two click-instances where I finally could define an “Image” and determine where the “click” should land.
This last part took some trial-and-errors… until I observed that when you click the ‘Go’ button and the image is found, the mousecursor is placed relative to the values you have entered into the ‘right’ and ‘down’ fields. I failed umpteen times because I used the ‘Get’ button. The manual for KM does not specify this, really, not what I have found. But now I know. An the macro’s work ‘all over the screen’

Now for coffee.

Kind regards


1 Like

Congratulations! I can see that you received a lot of good help here.

Please post your final macros here so that others can benefit.

If one of the above posts solves your problem/question as originally stated, please check the "Solved" checkbox (click for details) at the bottom of that post.

Otherwise, please post your remaining questions/issues about this problem.
If you have other questions, please start a new topic.

How do I post my macro? and in which form? screenshot or...?


Ok I found the link in KM, very neat :sunglasses:


Ok I saw the video and so I post the macro in this thread:
“1_Scriv_Copy_Paste” Macro

1_Scriv_Copy_Paste.kmmacros (10 KB)

Here are the next macro. It is called from the first one but works fine by itself:

“2-Afsnits_mellemrum” Macro

2-Afsnits_mellemrum.kmmacros (50 KB)

This third macro comes handy when source being copied have different (weird) indents:

“3_NYT_margin_fixer” Macro

3_NYT_margin_fixer.kmmacros (28 KB)

This last macro #4 is short but practical to get the Synopsis entered into Scrivener.
It uses a standard mouseclick, buy since the "Font-box" always sits in the same place at the lower righthand corner it is not depending on the placement of your Scrivener window:

“4_Header-Synopsis” Macro

4_Header-Synopsis.kmmacros (17 KB)

Just updated to Mojave, works ok, then I experienced a number of times that this macro "3_NYT..." aborted during the last part when "using found image.."
Turned out that sometimes the window containing the image would be floating over some dark background and therefore not fit the pattern of expect image. This I could not control, but since the macro uses a similar approach in the start, which will alway float over a nonchanging part of the screen I used this image instead and adjusted the distance to my target button.
Now it is stable again :slight_smile: