テキストエディタ“mi”向けスクリプト

テキストエディタ“mi”向けAppleScriptです。
ツールやツールバーに登録しておくと捗ります。
mi

🌟新規ドキュメントに複製

tell application "mi"
set aMode to get mode of front document
set aCon to get content of front document
make new document with properties {text encoding:"UTF-8", return code:LF, mode:aMode, content:aCon}
end tell

🌟選択範囲を新規ドキュメントに複製

tell application "mi"
set aMode to get mode of front document
set aCon to get selection of front document
make new document with properties {text encoding:"UTF-8", return code:LF, mode:aMode, content:aCon}
end tell

🌟PhotoshopでJavaScriptを実行

tell application "mi"
if mode of front document is "JavaScript" then
set javaScriptCode to content of front document
else
beep
return
end if
end tell

tell application id "com.adobe.Photoshop"
try
do javascript javaScriptCode
on error msg
display alert msg
end try
end tell

🌟クリップボードにコピーしたYouTubeの動画リンクから埋め込みコードを作成しmiにペースト(2021年12月05日 更新)

set originalVideoLink to get the clipboard

if originalVideoLink begins with "https://youtu.be/" then
set embeddedURL to "<iframe style=\"border: none;\" width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/" & (text ((offset of "youtu.be/" in originalVideoLink) + 9) thru -1 of originalVideoLink) & "\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
set the clipboard to embeddedURL
tell application "mi"
set selection of document 1 to embeddedURL
end tell
else
beep
delay 0.3
return
end if

更新履歴

inserted by FC2 system