I have a macro in Keyboard Maetro that makes edits to the current line of text in an RTF document (moves the cursor to the beginning of the line, adds text, etc.). I want to prevent that macro from firing unless a text document is actively being edited (the cursor is “live”).
I was thinking of using an AppleScript test to return this state, but am not sure how or if it is possible.
I know “content record” will tell me if a document is open:
if not (exists content record) then error "Please open a document."
But is there a similar way to test if the cursor is “live” within that document? I tried “current line”:
set this_line to the current line of current tab of think window 1
but that seems to remember the last selected position in the document, even if the cursor is not alive (e.g. if you place the cursor or line 10, select another document, then return to the first without placing the cursor, it will return “10”)
Thanks,
Dan