JeditXAppleScript

htmlentities

ホームページやBLOG等にHTMLやXMLなんかを投稿する場合の
htmlentities変換
CotEditor用とJedit Ω用
選択部分のテキストを変換します。


ダウンロード - scripts.zip


Htmlentities


tell application "Jedit Ω"
tell front document
set TheTextToEncode to selected text
end tell
end tell

----スラッシュ文字のエスケープ
set TheTextToEncode to my doReplace(TheTextToEncode, "'", "\\'")
set TheTextToEncode to my doReplace(TheTextToEncode, "\"", "\\\"")


set theHtmlEntitiesText to do shell script ("echo \"<?php print(htmlentities('" & TheTextToEncode & "'));?>\" | php")

----改行変換とスペース変換タブ変換はお好みで
set theHtmlEntitiesText to my doReplace(theHtmlEntitiesText, "\r", "\n")
set theHtmlEntitiesText to my doReplace(theHtmlEntitiesText, " ", "&nbsp;")
set theHtmlEntitiesText to my doReplace(theHtmlEntitiesText, "\t", "&#9;")


tell application "Jedit Ω"
tell front document
set selected text to theHtmlEntitiesText
end tell
end tell




--------------文字の置き換えサブルーチン
to doReplace(theText, theOrgStr, theNewStr)
set theOldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to theOrgStr
set theTmpList to every text item of theText
set AppleScript's text item delimiters to theNewStr
set theReplaceStr to theTmpList as text
set AppleScript's text item delimiters to theOldDelim
return theReplaceStr
end doReplace



tell application "CotEditor"
tell front document
set TheTextToEncode to contents of selection
end tell
end tell


----スラッシュ文字のエスケープ
set TheTextToEncode to my doReplace(TheTextToEncode, "'", "\\'")
set TheTextToEncode to my doReplace(TheTextToEncode, "\"", "\\\"")


set theHtmlEntitiesText to do shell script ("echo \"<?php print(htmlentities('" & TheTextToEncode & "'));?>\" | php")

----改行変換とスペース変換タブ変換はお好みで
set theHtmlEntitiesText to my doReplace(theHtmlEntitiesText, "\r", "\n")
set theHtmlEntitiesText to my doReplace(theHtmlEntitiesText, " ", "&nbsp;")
set theHtmlEntitiesText to my doReplace(theHtmlEntitiesText, "\t", "&#9;")


tell application "CotEditor"
tell front document
set contents of selection to theHtmlEntitiesText
end tell
end tell




--------------文字の置き換えサブルーチン
to doReplace(theText, theOrgStr, theNewStr)
set theOldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to theOrgStr
set theTmpList to every text item of theText
set AppleScript's text item delimiters to theNewStr
set theReplaceStr to theTmpList as text
set AppleScript's text item delimiters to theOldDelim
return theReplaceStr
end doReplace

|

【Jedit Ω】選択HTMLをhtmlentities変換してBLOG等に貼り付けられるようにする

Screencapture-20210912-193933

こんな感じね

ダウンロード - htmlentities2.zip

|

AppleScriptでの改行

Website_image20111224_00318

続きを読む "AppleScriptでの改行"

| | トラックバック (0)

[make new document] properties付きでドキュメントを作る

Website_image20111223_215406 プロパティを確認出来ます。
tell application "Jedit X"
activate
make new document
tell document 1
properties
end tell

end tell

「properties.rtf」をダウンロード

「properties.scpt.zip」をダウンロード

では

続きを読む "[make new document] properties付きでドキュメントを作る"

| | トラックバック (0)

その他のカテゴリー

Accessibility AccessibilityCheck AccessibilityForm AccessibilityInDesign AccessibilityPDF Acrobat Acrobat Action Acrobat Annotation Acrobat AppleScripts Acrobat Character Acrobat Layer Acrobat PDF Embed API Acrobat PDF Form Print Acrobat Plug-ins Acrobat Portfolios Acrobat Print AcrobatBarcode AcrobatDialog AcrobatForm AcrobatJS AcrobatMenu AcrobatPDF AcrobatStamp AcrobatYouTube AddressBook Adobe Adobe InDesign Adobe Photoshop AdobeAppleScript AdobeBridge AdobeIllustrator AdobeJSX aed Alfresco Android AnimationGif Apple Apple Support AppleScript AppleScriptBasics AppleScriptCharacter AppleScriptColor AppleScriptDroplet AppleScriptErrorNum AppleScriptFolder AppleScriptFontBook AppleScriptRename AppleScriptTools AppleSymbols Applications Barcode Barcode2D BarcodePostal BetterHTMLExport Book BOX Browser buzz Certificates CharacterEntity CharacterSets Colors Cool Site CSS Cutting DecoMail DecorationMail Design Desktop Diff DJ dmg DNS Documents Download DTP eBook Editer eMail Envelopes ExifTool Facebook FFmpeg File System Fonts FontsTool FontsWeb FOOD FormPrint ftp Gadget Gif Animation Google Google Chrome Enterprise HexEditor HTML info iPhoto ISBN ISO iTunes iWork iWorkNumbers iWorkNumbersCalendar iWorkNumbersTimecard iWorkPages JavaScript JeditX JeditX Regexp JeditXAppleScript JIS jquery Letterpress Library logo Mac Admin Mac Archiver Mac Browser Mac Browser Plugin Mac QuickLook Mac Setup Mac Spotlight Mac Video Map Memo Microsoft Teams Mobby mobileconfig Moto Movies Music Network Basic ntp OCR Office OfficePowerPoint OSX Paint Pantone Paper PDFlib Permission Photo Pictograms Print Public Python QuickLook QuickTime QuickTimeSetting QuickTimeSound Real Media ReName ResourceFork ruby Sample Screen ScreenCast Search Security SEO Sharing SLAResource Sound Spotlight Stamp SWF TCC.db Tutorial PSD TV Twitter Typography Unicode Utilities Video WEB APP WebFont Wedding Windows WindowsMedia XML XMP XPS YouTube YouTube Rss