Skip to content

Instantly share code, notes, and snippets.

@azur256
Created May 19, 2012 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azur256/2728797 to your computer and use it in GitHub Desktop.
Save azur256/2728797 to your computer and use it in GitHub Desktop.
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