UPLOAD KM Macro to New or Existing Topic

MACRO:   Upload KM Macro to New or Existing Topic @KM [Pub]

==UPDATED==: 2021-03-12 18:32 GMT-6

  • Ver 2.4 provides an update to work with the latest versions of KM and macOS.

--- VER: 2.4    2021-03-12 ---
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Upload KM Macro to New or Existing Topic @KM [Pub].kmmacros

Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.

See Also

You may also be interested in these related macros:

Example Prompts







• Upload Selected KM Macro (file & image) to KM Forum, to a NEW or EXISTING Topic


  1. Select macro for editing (focus can be on macro or any Action in the macro)
  2. Trigger this macro -- Default set to HotKey ⌃⇧U
    • Normal press key -- Post to NEW Topic
    • Long press key -- Post to EXISTING Topic
    • IF you change the Trigger, you will need to change this Action to match:
    "Check for Long Press Hot Key. . ."

User is Prompted to Confirm Upload, before proceeding

  • Provides Options for where to post, and whether to include ReleaseNotes.


  1. Sets focus to Macro in Macros Panel
  2. Performs Macro Upload (file & image) using the KM Editor Share Button
    • Creates a NEW KM Forum Topic (in the "macro" Catgegory), with the Macro Name as the Topic Title
    • IF Option is for EXISTING Topic, new Topic is canceled
  3. Final Output:
    • IF NEW Topic:
    • Pastes reformatted upload links and RN in KM Forum Post
    • IF EXISTING Topic:
    • All upload info is put on Clipboard, ready to paste into existing topic


  1. Keyboard Maestro Ver 8.2+
  2. Sierra (10.12.6)+
  3. Default Browser must be either Safari or Google Chrome

TAGS: @KM, @Macro, @Upload, @Forum, @Tool, Macro Library

By downloading or installing this software, you agree to the terms of usage in the below Action labeled "License and Usage Agreement". Do not install or use if you do not agree.

License and Usage Agreement

Copyright (c) 2021, JMichaelTX

By downloading or installing this software, you agree to the following statements. DO NOT INSTALL OR USE IF YOU DO NOT AGREE.

"Software" refers to any and all data and computer software related to this Keyboard Maestro Macro, including, but not limited to: instructions, macros, actions, plugins, scripts, and resources . It includes everything in the download file(s).

Permission is hereby granted to anyone to use, copy, and/or modify the software, without any charge. The software may be redistributed provided that: (1) It is offered free of charge to others; (2) The following are included in and appear in all copies: (a) The above copyright notice; (b) This License in its entirety; and (c) Attribution is given to the original author named in the above ReleaseNotes.

The software is provided "as is" and the author disclaims all warranties with regard to this software including all implied warranties of merchantability and/or fitness for a particular purpose.

In no event shall the author or Copyright holder be liable for any special, direct, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software.


Note that the Comment Action in this macro is a good example of how to format the Action for use as ReleaseNotes:

1 Like

Get Keyboard Maestro Forum Editor Text from Front Safari Window

Just updated my OP with this section, which was inadvertently left out.
Sorry, guys.

Just added the above section/macro link.


I haven’t had a chance to troubleshoot it today, but perhaps you can more quickly point me in the right direction regarding the following error attempting to use the macro last night to post my question.

2016-08-31 23:22:32 Search Variable failed to match (<a class.+)\n*(<img.+)
2016-08-31 23:22:32 Search Variable failed to match (<a class.+)\n*(<img.+) Macro ‘[KM] UPLOAD Macro to New or Existing Topic’ cancelled (while executing Search Variable ‘MacroUploadLinks’ Using Regular Expression (ignoring case)).

I see now it appears to have failed searching for Release Notes where there were none in my macro.

I just tested it with a macro that does not have ReleaseNotes nor even a Comment action at the top of the macro and it worked fine.

Please post the following:

  1. Your Default Browser
  2. macOS version
  3. KM version
  4. Do a manual upload using the KM Editor Share button, and when it is finished copy the contents of the Editor. Then paste the contents in reply here using a code block.

Safari v9.1.2
OS X El Capitan v10.11.6
Keyboard Maestro v7.2.1

Keyboard Maestro “Watch For Any Keyboard Entry” Macro

Watch For Any Keyboard Entry.kmmacros (2.8 KB)

Just uploaded an update.
This is a major change.

KM, sorry, I just now noticed that you had responded to my earlier request.
I am unable to reproduce your issue, although I mostly use Chrome, but have done a fair amount of testing using Safari.

All of your versions look fine. The only difference from mine is that you are on 10.11.6, whereas I'm on 10.11.4. There were some changes in 10.11.5 that changed Safari and broke some KM features.

Have you make the changes below that @peternlewis suggested:

If you have made those changes, and the macro (please update to the new version I posted today) still does not work correctly, please do this:

  1. Goto KM Status menu, and select "Start Debugging"
  2. Goto a KM macro, and trigger my [KM] Upload Macro
  3. Step through the macro until you get the error
  4. Take a screenshot of:
  • The error msg
  • The KM Debug Panel
  1. Post these screenshots in a reply to this topic.

Unless it is something complicated (like Apple making unknown changes to Safari), we should be able to get it working for you in short order.


I tried your macro again in providing my response to your query about adding text to the clipboard that you should see. However, I got the following error. I apologize that I did not step through the macro and capture the screenshot as you requested.

2016-09-19 17:10:05 Execute macro ‘[KM] UPLOAD Macro to New or Existing Topic’ from trigger The Hot Key ⌃⇧U is pressed
2016-09-19 17:10:48 Search Variable failed to match (<a class.+)\n*(<img.+)
2016-09-19 17:10:48 Search Variable failed to match (<a class.+)\n*(<img.+) Macro ‘[KM] UPLOAD Macro to New or Existing Topic’ cancelled (while executing Search Variable ‘MacroUploadLinks’ Using Regular Expression (ignoring case)).

Without doing that and sending me the screenshot, I am unable to diagnose your issue.

I have use this macro many, many times, and have never seen that error.
No one else has reported it.

Are you using the latest version of my macro (posted at the top of this page)?

Just posted an update to my OP, above.