我正在寻找一种方法来比较两个忽略 TextWrangler 中的空格的文档。虽然 TextWrangler 的界面没有提供该选项,但我发现了这个https://groups.google.com/d/msg/bbedit/ER3VdOf2xOs/IcKi3ccA90oJ
现在这不是一个完全有效的解决方案。虽然这个脚本:
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}
它只是不编译。什么……?