0
私の目標は、Alt + Enterを押すと自動的に箇条書きを挿入するようにします。私はBBEditの中でこれをやろうとしていると、ここで私はBBEditのフォーラムから引っかかるアップルスクリプトは次のとおりです。タブストップまたは空白の数を取得し、Applescriptで連結します(箇条書きを挿入するためのスマート改行スクリプト)
tell application "BBEdit"
try
tell text of front text window
set lineOfInsertionPoint to line (startLine of selection)
set findReco to find "^\\s*\\d+\\." searching in lineOfInsertionPoint options {search mode:grep}
if found of findReco = true then
set leadingNumber to text 1 thru -2 of (found text of findReco)
set text of selection to return & (leadingNumber + 1) & ". "
select insertion point after selection
else if found of findReco = false then
set findReco to find "^\\s*\\* " searching in lineOfInsertionPoint options {search mode:grep}
if found of findReco = true then
set text of selection to return & "* "
select insertion point after selection
else
set findReco to find "^\\s*\\+" searching in lineOfInsertionPoint options {search mode:grep}
if found of findReco = true then
set text of selection to return & tab & "+ "
select insertion point after selection
end if
end if
end if
end tell
on error errMsg number errNum
set sep to "=============================="
set e to sep & return & "Error: " & errMsg & return & sep & return ¬
& "Error Number: " & errNum & return & sep
beep
display dialog e
end try
end tell
スクリプトがうまく動作しますが、問題は、あなたが既に持っているとき、タブの一定数が停止または白ということです最初のスペースでは、ホワイトスペース/タブストップを無視して行頭に次の箇条書きを挿入します。
私の実際の質問は、「単純にAppleScriptを使用して先頭のタブストップまたは空白の数を取得する方法」であり、ここでそれを連結します。
乾杯。