Я искал способ сравнения двух документов, игнорирующих пробелы в TextWrangler. Хотя интерфейс TextWrangler не предоставляет эту опцию, я нашел это https://groups.google.com/d/msg/bbedit/ER3VdOf2xOs/IcKi3ccA90oJTextWrangler: сравнение двух документов, игнорирующих пробелы с помощью AppleScript
Теперь это не было полностью работающим решением. Хотя этот сценарий:
tell application "TextWrangler"
compare document 1 against document 2 options ¬
{case sensitive:true, ignore curly quotes:true, ignore extra spaces:true, ignore leading spaces:true, ignore trailing spaces:true}
end tell
работает, он несколько негибкий. Так что я попытался сделать вторую заглушку работу:
set compOpts to {"All Options:false", "case sensitive:true", "ignore curly quotes:true", "ignore extra spaces:true", "ignore leading spaces:true", "ignore trailing spaces:true"}
tell application "TextWrangler"
tell me to set compOpts to choose from list compOpts ¬
with title "Compare Front Two Documents" with prompt ¬
"Select Options" default items (items 2 thru -1 of compOpts) ¬
multiple selections allowed true ¬
with empty selection allowed
display dialog compOpts as string
set compareOptions to make new Compare Options with properties compOpts
compare document 1 against document 2 options compareOptions
end tell
, но здесь я получаю ошибку:
error "TextWrangler got an error: Can’t make class Compare Options." number -2710 from Compare Options to class
, что я делаю неправильно здесь?
Я хочу добавить, что следующий скрипт работает:
tell application "TextWrangler"
set compareOptions to ¬
{case sensitive:true, ignore curly quotes:true, ignore extra spaces:true, ignore leading spaces:true, ignore trailing spaces:true} ¬
compare document 1 against document 2 options compareOptions
end tell
, но это не работает:
set compareOptions to {All Options:false, case sensitive:true, ignore curly quotes:true, ignore extra spaces:true, ignore leading spaces:true, ignore trailing spaces:true}
он просто не компилируется. Что за … ?
Ваш код работает как очарование! Итак, важный момент, который, как я понимаю, заключается в том, что вы не можете преобразовать строковое представление параметров в объект класса Compare Options of TextWrangler, правильно? Поскольку ваш ответ хороший, я бы хотел его проголосовать, но я не могу, так как мне не хватает репутации, чтобы сделать это, извините! –