【问题标题】:Script editor opening folder and questioning to delete it脚本编辑器打开文件夹并询问删除它
【发布时间】:2017-12-04 16:48:34
【问题描述】:

我想让程序打开一个文件夹,然后显示一个文本来删除这个文件夹,但我无法让它工作。任何帮助表示赞赏。

    on opening folder theResponse
    tell application "Finder"
    set theName to name of theResponse
    activate
    display alert "Attention!" message "The folder" & theName & " was opened."
    set question to display dialog "Do you want to delete this folder?" buttons {"No", "Yes"} default button "No"
    set answer to button returned of question
    if answer is equal to "Yes" then
    set sourceFolder to theName
    move sourceFolder to the trash
        end tell
    end opening folder

【问题讨论】:

    标签: macos applescript finder


    【解决方案1】:

    theName 是文件夹名称——一个字符串——例如PicturesMovies。您需要对文件夹(Finder 说明符或别名)的引用,即 theResponse

    删除

    罢工>

    set sourceFolder to theName
    

    改变

    move theResponse to the trash
    

    【讨论】:

      猜你喜欢
      • 2016-04-11
      • 2013-11-21
      • 1970-01-01
      • 2015-05-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-05
      • 2020-06-22
      • 1970-01-01
      相关资源
      最近更新 更多