Get Discourse Forum Code Block & Post Info [TEST]

##Macro Library   Get Discourse Forum Code Block & Post Info [TEST]


####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/7/70b946a7da5199f491d4b8ff764cf71be74e84ee.kmmacros">Get Discourse Forum Code Block & Post Info [TEST].kmmacros</a> (38 KB)

---

<img src="/uploads/default/original/2X/9/9fa034801953dfe7d1745afcb7087c7530a06e23.gif" width="70" height="17">  2016-08-23 22:59 CT (Tue)

* Fixed Date bug
* Added Script Language as output

---
###This is a TEST

* For those of you who like to try shiny new things, with minimal risk, please give this a try.
* It is part of larger macro I'll be publishing soon.
* **Please post any/all feedback.**

###Example Results

<img src="/uploads/default/original/2X/5/558376b164d407e1e6359c59dfa9a783a9a45e69.png" width="523" height="291">

####Two Big Deals

1. All of the data is returned in fields, so you can use as you like. (see below).
2. This captures the **Reply Post** info (as opposed to the Topic/Page info) for Author, Date, & URL, which is hard to get.
###ReleaseNotes

Author.@JMichaelTX

HOW TO USE:

1. Select, or mouse-over, text in a Code Block in a Discourse Forum
2. Trigger this macro.

PURPOSE:  

* Auto-Select and Copy Entire Code Block on Web Page
* Get Author and Post Date

RETURNS: 

* The following, separated by a vertical bar("|")
      * authorName
      * postDate
      * postURL
      * docTitle
.
* IF ERROR, you get a nice, friendly, error message.
      
  Example:

> JMichaelTX|2016-08-23|https://forum.keyboardmaestro.com/t/why-do-we-code-jxa-scripts-using-closures/4739/12|Why do we code JXA scripts using closures? - general - Keyboard Maestro Discourse


---

<img src="/uploads/default/original/2X/0/0486ef55ff3358d4352bc896fa014f6eba8e12cd.png" width="589" height="1526">
1 Like

###Bug: Post Date is being converted to GMT when using this function:

dateNow.toISOString()

I thought it just converted to the ISO format (yyyy-mm-dd), but it also changes the time to zulu time!!!

Anyone know a better JavaScript function to just get the ISO format?

Just posted update.

Coming soon: An update using @DanThomas' great JSON method for passing variable between JavaScript > KM > JXA.

Should be later today.