I love KM8, but it has broken one of my major workflows: Posting of ReleaseNotes with my macro uploads.
In virtually every Macro I write, I have a Comment Action at the top, which contains my ReleaseNotes for that Macro. Prior to KM8, I could read the plain text of the Comment Action in a script, and then paste into a KM Forum topic where I am upload my macro.
KM8: How Can I get Plain Text from a Comment Action?
Now the Comment Action uses Rich Text, which is available in an encoded format in the XML of the Action. But I have been unsuccessful in converting that encoded rich text into plain text.
@peternlewis, may I request that you provide us with a scripting command that:
- Returns plain text for any selected "
<styled text>" element in the XML.
- Return rich text as plain text (like HTML) that can be edited.
- Sets/Updates the Action from a revised rich text string.
As you know from our discussion in KM8: XML of Display Text in Window Does Not Update by Script, this is not something that is easly converted (decoded, encoded) using AppleScript. So any help you can give us would be greatly appreciated.
If there is an ASObjC or Bash script that will do the job now, I'm fine with that. My problem is that I don't know enough about either to write such scripts.
Here is an example XML from a KM8 Comment Action:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<string>~~~ ReleaseNotes for VER: 1.0 DATE ~~~</string>
The plain text looks like this:
1. **KM 8.0.2+**
* But it can be written in KM 7.3.1+
* It is KM8 specific just because some of the Actions have changed to make things simpler, but equivalent Actions are available in KM 7.3.1.
2. **macOS 10.11.6 (El Capitan)**
* KM 8 Requires Yosemite or later, so this macro will probably run on Yosemite, but I make no guarantees. :wink:
This is just a brief example of my normal ReleaseNotes.
Example Script to Get XML of First Action of a Selected Macro
tell application "Keyboard Maestro"
set oMacro to item 1 of (get selected macros)
set actionList to actions in oMacro
set oAction to item 1 in actionList
set actXML to xml
end tell -- oAction
end tell -- KM
set the clipboard to actXML