仅适用于1个当前文档并更改

时间:2015-09-08 07:15:46

标签: applescript

嗨下面是苹果脚本,它确实找到并更改了indesign文档中的操作。但是这个脚本没有执行并且出错。

  

" Adob​​e InDesign CS6出错:无法将文档1的查找文本首选项设置为空。"

脚本是

tell application "Adobe InDesign CS6"
  tell front document
    set find text preferences to nothing
    set change text preferences to nothing
--Letter Z--
    set case sensitive of find change text options to true
    set abbreviation to ".<005A>"
    set thinspace to ". <005A>"
    set find what of find text preferences to abbreviation
    set change to of change text preferences to thinspace
    change text
    set find text preferences to nothing
    set change text preferences to nothing
  end tell
end tell

请建议任何人。

这应仅针对打开的文档运行。删除前端文档时,此脚本将运行。

我无法解决错误。

1 个答案:

答案 0 :(得分:0)

find text preferenceschange text preferences属于应用程序,而不属于文档。试试这个

tell application "Adobe InDesign CS6"
    if (count documents) is 0 then return
    set find text preferences to nothing
    set change text preferences to nothing

    set case sensitive of find change text options to true
    set abbreviation to ".<005A>"
    set thinspace to ". <005A>"
    set find what of find text preferences to abbreviation
    set change to of change text preferences to thinspace
    tell document 1
        change text
    end tell
    set find text preferences to nothing
    set change text preferences to nothing
end tell