无法在 Apple 脚本中找到指定应用程序的应用程序支持文件夹
Unable to find the application support folder for a specified application inside an Apple Script
我有一个 apple 脚本,要求用户 select 一个应用程序作为提示。我想知道如何找到每个示例的应用程序支持文件夹的目录,Spotify 是
~/Library/Application Support/Spotify/
在我的 mac 上,但是苹果脚本中是否有一种方法可以找到特定应用程序的目录。非常感谢,谢谢!
因为我想使用 Apple Script 删除这个文件夹
这应该可以实现您想要实现的目标。不过要小心,因为使用 System Events
到 delete
... 会永久删除该项目,而不是将其发送到 Trash
property folderNames : missing value
tell application "System Events"
set appSupportFolder to application support folder
set folderNames to name of folders of appSupportFolder
set theChoice to my chooseFolderToDelete()
delete folder theChoice of appSupportFolder
end tell
to chooseFolderToDelete()
activate
set theChoice to (choose from list folderNames with prompt ¬
"Select an Application's Support folder to delete" OK button name ¬
"Delete Folder" cancel button name "Cancel") as text
end chooseFolderToDelete
我有一个 apple 脚本,要求用户 select 一个应用程序作为提示。我想知道如何找到每个示例的应用程序支持文件夹的目录,Spotify 是
~/Library/Application Support/Spotify/
在我的 mac 上,但是苹果脚本中是否有一种方法可以找到特定应用程序的目录。非常感谢,谢谢!
因为我想使用 Apple Script 删除这个文件夹
这应该可以实现您想要实现的目标。不过要小心,因为使用 System Events
到 delete
... 会永久删除该项目,而不是将其发送到 Trash
property folderNames : missing value
tell application "System Events"
set appSupportFolder to application support folder
set folderNames to name of folders of appSupportFolder
set theChoice to my chooseFolderToDelete()
delete folder theChoice of appSupportFolder
end tell
to chooseFolderToDelete()
activate
set theChoice to (choose from list folderNames with prompt ¬
"Select an Application's Support folder to delete" OK button name ¬
"Delete Folder" cancel button name "Cancel") as text
end chooseFolderToDelete