Macos 预期行结束,但找到“&引用”;。出现在apple脚本编辑器上

Macos 预期行结束,但找到“&引用”;。出现在apple脚本编辑器上,macos,applescript,editor,Macos,Applescript,Editor,我只是在学习不同的编码,对html、css和javascript有相当多的了解。我对apple脚本编辑器完全陌生。部分告诉应用程序“finder”有两个打字错误,缺少一个空格。它应该是告诉应用程序“Finder” 整个想法应该是这样的,为我构建的 tell application "Finder" to say "this is a test" tell aplication"finder" activate repeat 5 times make new F

我只是在学习不同的编码,对html、css和javascript有相当多的了解。我对apple脚本编辑器完全陌生。

部分
告诉应用程序“finder”
有两个打字错误,缺少一个空格。它应该是
告诉应用程序“Finder”

整个想法应该是这样的,为我构建的

tell application "Finder" to say "this is a test"
tell aplication"finder"  
    activate
    repeat 5 times
        make new Finder window
    end repeat
end tell

既然你是applescript新手,我就给你一个基本的学习技巧。只告诉应用程序做它知道如何做的事情。每个应用程序都知道如何做特定的事情,applescript也知道如何自己做事情

我之所以这样说是因为“say”命令是applescript命令,而不是Finder命令。因此,没有理由告诉发现者说什么。随着脚本变得越来越复杂,如果告诉错误的应用程序执行某些操作,就会发现错误。因此,您可以自行运行say命令。试试这个,它会自己工作

tell application "Finder" to say "this is a test"
tell application "Finder"
    activate
    repeat 5 times
        make new Finder window
    end repeat
end tell
了解每个应用程序理解什么的最简单方法是查看字典。在脚本编辑器中,在“文件”菜单下选择“打开字典”。您可以选择任何应用程序,但对于本例,请打开Finder字典。你可以通过搜索来找到查找者知道怎么做。您会注意到它没有“say”命令,因此您知道不要告诉查找程序使用say命令。您可以在搜索字段中键入“say”,您将看到它不会返回任何结果

如果你打开“StandardAdditions”的字典,你会在里面找到say。这是applescript自己知道的其他事情


祝你好运。

非常感谢你,我到处寻找答案,似乎没有一个答案是针对我的问题的。如果你打算否决这个答案,请添加一条评论,说明原因。据我所知,这回答了人们提出的问题。
say "this is a test"