Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Replace more tag.
tell application "MarsEdit"
try
set currentWindow to document 1
on error errorMessage
display dialog ("Error: window are not opened.") buttons {"OK"} default button "OK" with icon caution
return
end try
set currentTextView to current text of currentWindow
if (currentTextView is "") then
display dialog ("No text") buttons {"OK"} default button "OK" with icon caution
return
else
set orig_delimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to "<a name='more'></a>"
set tmp_list to every text item of currentTextView
set AppleScript's text item delimiters to "<!--more-->"
set target_text to tmp_list as string
set AppleScript's text item delimiters to orig_delimiter
end if
set current text of currentWindow to target_text
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment