Applescript重命名应用程序文件夹中的文件
Applescript to rename a file in the applications folder
我正在尝试使用脚本重命名应用程序文件夹中的文本文件。我正在尝试以下
tell application "Finder"
set name of file "File.txt" of applications folder to "File.txt.OFF"
end tell
但这给出了一个错误:
Can’t get file "Text.txt" of applications folder.
它肯定在那儿,并称之为(它是复制和粘贴)。然后我尝试删除文件夹位:
set name of file "File.txt" of applications to "File.txt.OFF"
但是又出现了另一个错误:
Finder got an error: Can’t set every application to "Text.txt.OFF".
如有任何帮助,我们将不胜感激。
干杯
Finder 术语中的 applications folder
未指向标准文件夹 /Applications
。它似乎是对某些 OS X 之前的项目的遗留引用。
试试这个,但您可能没有更改名称的权限,而且无论如何也不鼓励您将文本文件等任意数据放入 /Applications
set applicationsFolder to path to applications folder
tell application "Finder"
set name of file "File.txt" of applicationsFolder to "File.txt.OFF"
end tell
或使用System Events
tell application "System Events"
set name of file "File.txt" of applications folder of local domain to "File.txt.OFF"
end tell
我正在尝试使用脚本重命名应用程序文件夹中的文本文件。我正在尝试以下
tell application "Finder"
set name of file "File.txt" of applications folder to "File.txt.OFF"
end tell
但这给出了一个错误:
Can’t get file "Text.txt" of applications folder.
它肯定在那儿,并称之为(它是复制和粘贴)。然后我尝试删除文件夹位:
set name of file "File.txt" of applications to "File.txt.OFF"
但是又出现了另一个错误:
Finder got an error: Can’t set every application to "Text.txt.OFF".
如有任何帮助,我们将不胜感激。
干杯
applications folder
未指向标准文件夹 /Applications
。它似乎是对某些 OS X 之前的项目的遗留引用。
试试这个,但您可能没有更改名称的权限,而且无论如何也不鼓励您将文本文件等任意数据放入 /Applications
set applicationsFolder to path to applications folder
tell application "Finder"
set name of file "File.txt" of applicationsFolder to "File.txt.OFF"
end tell
或使用System Events
tell application "System Events"
set name of file "File.txt" of applications folder of local domain to "File.txt.OFF"
end tell