【问题标题】:Applescript: expected expression but found "/"Applescript:预期的表达式,但找到“/”
【发布时间】:2014-05-14 19:27:19
【问题描述】:

我正在寻找一个脚本,它将我在 Safari 中打开的标签页的 URL 保存到一个文本文档中,以便我以后可以打开它们(它的 10 多个标签页)。我在网上找到了这个脚本:

[applescript]
tell application "Safari"

--Variables
set windowCount to number of windows
set docText to ""

--Repeat for Every Window
repeat with x from 1 to windowCount
set tabcount to number of tabs in window x

--Repeat for Every Tab in Current Window
repeat with y from 1 to tabcount

--Get Tab Name & URL
set tabName to name of tab y of window x
set tabURL to URL of tab y of window x

set docText to docText & "<a href=" & "\"" & tabURL & "\">" & tabName & "</a>" & linefeed as string
end repeat

end repeat
end tell

--Write Document Text
tell application "TextEdit"
activate
make new document
set the text of the front document to docText
end tell

[/applescript]

但是当我尝试运行它时,我得到了错误

预期的表达式,但找到“/”

并将最后一行 [/applescript] 标记为错误。我已经搜索了错误,但似乎找不到它。有人有想法吗?

【问题讨论】:

  • 如果某个答案解决了您的问题,您可以点击答案投票数下方的复选标记使其变为绿色。

标签: applescript


【解决方案1】:

删除[applescript][/applescript]

【讨论】:

    【解决方案2】:

    当您将脚本放入 AppleScript 编辑器时,您可能应该删除 [applescript][/applescript] 行。

    【讨论】:

    • 谢谢!现在完美运行!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-03
    • 1970-01-01
    • 1970-01-01
    • 2017-03-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多