home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacPeople 2003 February 1
/
MACPEOPLE-2003-02-01.ISO.7z
/
MACPEOPLE-2003-02-01.ISO
/
ぶらりオンラインウェアの旅
/
定番ソフト
/
Jedit(OS9)
/
MacroCollectionJ.sea
/
MacroCollection-J
/
英単語半角スペース削除
/
スクリプト解説
< prev
next >
Wrap
Text File
|
2001-01-01
|
1KB
|
42 lines
英単語前後の半角スペースを削除 マクロ
programmed by Satoshi Matsumoto <satoshi@matsumoto.co.jp>
選択領域のなかにある英単語の前後が半角スペースで日本語に隣接しているときは、その半角スペースを削除する。
ーーーーーーーーーーーー
tell application "Jedit4"
Jeditのバージョンチェック。Rev4.0.4より古いときは中止
if version < 404 then
preDialog
display dialog "Jedit4.0 Rev4.0.4 以降を使用してください" buttons {" 了解"}
postDialog
error number -128
end if
書類がなにも開いていないときは警告をだして終了
if (count document) < 1 then
preDialog
display dialog "書類を先に開いてください。" buttons {" 了解"}
postDialog
error number -128
end if
tell document 1
Jeditの書類を前面へ
activate
なにも選択されていないときは全てを選択
if length of selection = 0 then
select (bytes 1 thru -1)
end if
選択領域の開始オフセットをtheStart
copy byteoffset of the selection to theStart
選択領域の終了オフセットを文末からの距離として負の値でtheEnd
copy length of the selection to theEnd
copy theStart + theEnd - (data size) - 2 to theEnd
英単語の左隣の半角スペースを削除
replace "{[1-熙]}¥¥s{¥¥w[!-¥¥h7E]+}" to "¥¥1¥¥2" in selection with grep
選択をし直す
select (bytes theStart thru theEnd)
英単語の右隣の半角スペースを削除
replace "{¥¥w[!-¥¥h7E]+}¥¥s{[1-熙]}" to "¥¥1¥¥2" in selection with grep
end tell
end tell