Hey Folks,
Some people are trying to automate the Keyboard Maestro forum editor, so let’s make that a little bit easier.
This script will fetch the text currently visible in Preview-Area of the forum editor.
-Chris
--------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2016/08/26 15:00
# dMod: 2016/08/26 15:16
# Appl: Safari
# Task: Get Keyboard Maestro Forum Editor Preview Text from Front Safari Window.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Safari, @Get, @Keyboard_Maestro, @Discourse, @Forum, @Editor, @Preview, @Text @Front, @Window
--------------------------------------------------------------------------------
# Get the Text Content of the editor block.
set forumEditorText to doJavaScriptInSafari("document.getElementsByClassName('d-editor-preview')[0].textContent")
--------------------------------------------------------------------------------
--» HANDLERS
--------------------------------------------------------------------------------
on doJavaScriptInSafari(javascriptStr)
try
tell application "Safari" to do JavaScript javascriptStr in front document
on error e
error "Error in handler doJavaScriptInSafari() of library NLb!" & return & return & e
end try
end doJavaScriptInSafari
--------------------------------------------------------------------------------
[ EDIT: 2016/08/27 13:15 – Altered Task Description – See new scripts below for working with the Keyboard Maestro Editor text field. ]