Suggestion for the KBM Macro Library: Start Macro With URL in Comment Box Referencing the KBM Forum Discussion

@ccstone @JMichaelTX @gglick @Tom and others often kindly write macros for forum members.

I have made it a habit to always include a comment box with the forum discussion URL at the beginning of the macro when I add it to my repertory. A very useful little trick: I often go back to the discussion when I subsequently want to make modifications.

example below of a macro written by @ccstone and added to my repertory.

image

1 Like

I’m doing the same, especially with non-trivial macros where I’m happily applying my own changes, and then —more often than not— have to go back to original post and discussion in order to adjust/correct my not-so-good changes ;).

An even better idea would be to post the discussion URL as a comment in the published macro. I know, you have to know the URL of your thread, but it shouldn’t be a problem to open the thread and then add the URL to the macro just before uploading it.

That being said, I’ve never done this :wink: (Except maybe in some updated versions of macros, not sure)

1 Like

I agree. The point of my message was to suggest that it should be included with published macros.

It seems somewhat tricky to do since the forum URL will not be known at the time of publishing the macro (not if you use the Share to Forum facility anyway).

It could be added and the macro re-uploaded, or for any updates, or you could create a new topic for the macro, and then share the macro to another new topic, cancel that and move the shared macro to the original topic, but any way you slice it the initial upload is going to be more tedious (maybe someone should automate it ;- ).

Hey @ronald,

If you think about it Peter's reply that this problem is tricky is on the money. There are simply too many variables to provide a canned macro solution.

However...

It's not overly hard to create the link. (This one is from Google Chrome – Safari will take require a little change of syntax.)

------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2019/04/17 02:19
# dMod: 2019/04/17 02:19 
# Appl: Google Chrome, Keyboard Maestro
# Task: Create RTF Link for Keyboard Maestro Forum Thread Title and URL and Place on the Clipboard.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Google_Chrome, @Keyboard_Maestro, @Create, @RTF, @Link, @Forum, @Thread, @Title, @URL, @Clipboard
------------------------------------------------------------

tell application "Google Chrome"
   tell front window
      set theTitle to its title
      set theURL to active tab's URL
   end tell
end tell
tell application "Keyboard Maestro Engine"
   set theTitle to search theTitle for " +- .+$" replace "" with regex
end tell

set theHTML to "<font face=\"Helvetica\" font size=3><a href=" & theURL & ">" & theTitle & "</a></font>"
do shell script "echo " & quoted form of theHTML & " | textutil -inputencoding UTF-8 -format html -convert rtf -stdin -stdout | pbcopy -Prefer rtf"

------------------------------------------------------------

My normal macro notes action is created entirely via a macro with a hotkey:

I've added in the RTF link here manually using the AppleScript above, but it should be possible to automate the entire process.

I'm too tired to fool with that at the moment, but I've made a note to look into it further.

-Chris

1 Like

thank you Chris. I will look into it.

I actually already had a macro which will do this:

MACRO: Add Comment Action to Selected Macro with REF Info from KM Forum Post Info

1 Like