My problem concerns Scrivener but requires no understanding of Scrivener. It applies to many other apps.
With Scrivener, I create "projects" which are simply groups and subgroups of files. Why Scrivener? Because it is multiple file friendly and the editor is powerful.
When I finish working on a project, I must export it (ie export all the files) : Scrivener will export them to Finder respecting the Scrivener folder structure which is very convenient, which makes the complete project accessible to people who don't know Scrivener and whose computer savvy is basically limited to MS Word. For this reason, I must always export Scrivener files as DOCX (Scrivener has many export options as you can see below).
My problem is:
Being a certified idiot, I am constantly making the mistake of exporting as RTF, the default, instead of picking docx from the export window dropdown list and I have to start over again.
To display the text "export as DOCX, not RTF" when I export in other words, display the text when the Files>Export>Files... is triggered.
What I tried and does not work:
- if Files... menu item is marked, enabled, etc (as displayed below) display text "export as DOCX, not RTF"
- because the export window contains an "Export" button, I tried all if "Export" button exists and all variants, but nothing works, which surprises me.
Thanks in advance for your time and help.
Export Display DOCX Text in Scrivener.kmmacros (19.1 KB)
This displays a notification as well as speaks the reminder. I find I ignore written reminders but never fail to heed to spoken ones.
The trick is the first action which simply select the Export Files menu option in Scrivener.
Scrivener Export to RTF Macro (v10.2)
Scrivener Export to RTF.kmmacros (2.5 KB)
What I did was add a keyboard shortcut to the Microsoft Word (.docx) file type in the export dialog.
The macro waits for the dialog to open and the Export button to exist and then presses that keyboard shortcut to select the .docx file format.
- The pure pause action may or may not be needed on your system, and the time paused may or may not need adjustment.
I would normally do this with AppleScript UI-Scripting, but this method is more accessible to more people.
** Note that adding keyboard shortcut for embedded menu items like this does NOT always work. You have to try it and see.
- Sometimes restarting the app is required.
- On rare occasions I've seen a reboot make the difference.
- Sometimes it just won't work at all.
I does work with Scrivener 3.x on my Mojave system though.
Scrivener ⇢ Test 01.kmmacros (3.7 KB)
thank you both very much
My apologies for a poorly formulated question.
Your idea of a spoken text is great. I am like you and usually just ignore messages. It's brilliant and will change my way of working with display text
I very much like your idea of using a sys pref keyboard shortcut → MS Word. It's innovative and something to remember.
Question for both of you
I would have liked the macro to be triggered irrespective of the way I export: via keyboard shortcut, via the app menu or via a KM macro or palette.
If I understand correctly, I would have to trigger both your macro via KM for it to run
The essence of my initial question (poorly formulated) is to ask whether there is a way to have the macro constantly active and on the lookout for export being activated by any means : via macro (problem solved) or via the Scrivener export shortcut ⇧⌘S or via the menu, simply because I don't have the discipline to stick to one method.
I am still puzzled as to why my initial macro which is simply on the lookout for an Export button when Scrivener is active (as defined by the group) does not work.
In addition to solving my problem, it would help me and probably other forum users to learn how to create "on the lookout for" macros.
thank you both again very much
P.S. @ccstone : Scrivener is not scriptable.
It can't be done – unless you have Keyboard Maestro constantly monitor for a found image or an extant button – and that would be resource intensive.
Scrivener is not attachable, therefore there's no way to know if/when you activate a menu item.
The best way to go about this is to hijack the normal export to files keyboard shortcut and train yourself to use that.
A very good suggestion. I will delete the shortcut using sys pref>keyboard for Scrivener and use it to trigger my macro in KM
Good to know. thank you
Not necessary – Keyboard Maestro will override the Scrivener keyboard shortcut if you use the same keys in the hotkey trigger.
** Note – I gave the embedded menu keyboard shortcut a very esoteric trigger that I'm not likely to use manually. If you don't do that you'll likely but up against yourself in the future.
Your macro had no trigger, so it would never run. The Action conditions that you were trying would only look out for buttons or menu items once the macro was running.
And even if you gave the Macro a trigger it would only run once. It would not constantly monitor Scrivener.
Something else I learned.
Yes, good idea.
Just to make sure I totally understand. There is no way that I could see some kind of warning (if only to tell me to watch out) if I trigger the export via the menu Files>Export>Files..., which I sometimes do by reflex and would not be covered by the solutions offered in response to my post.
It sound like I am being picky, but because of my bungle (RTF instead of docx) I have to repeat 2 massive Scrivener exports and spend hours re-arranging the files in Finder.
Yes, you are certainly right. I was confused by the macro group settings which I misconstrued as some kind of sentinel.
You'd have to continuously run a macro with a pause-until button-exists or a found-image action, and that would be problematic and resource intensive.
So – yes it could be done – but no it should not be done.
If Scrivener was attachable like BBEdit then it would be different ballgame, but alas Scrivener isn't even slightly scriptable.
As there is no "trigger by selected menu item" in Keyboard Maestro the only way would be to constantly monitor your activity when Scrivener was open to see if you ever chose that menu and as @ccstone has pointed out, that would be resource intensive.
I think the way I would go about this (if this Export is not something you do a lot and you don't want to use a hotkey which you'd have to remember) is to display a Palette for the Scrivener Group and just click on it to run the export macro. You could do this as well as giving the Macro a hotkey and the Palette then also acts as a reminder of the hotkey.
For example here is the Palette I use for Image Capture.
A good point. Thanks very much.