文件夹操作 .scpt 不起作用

文件夹操作 .scpt 不起作用

我正在尝试将此脚本与文件夹操作一起使用。我已通过启用默认脚本测试了文件夹操作中的功能,它有效。但这个脚本似乎不起作用?

on adding folder items to this_folder after receiving added_items
    tell application "Finder"
        repeat with aFile in added_items
            if the name extension of aFile is "mp3" then
                move aFile to Muisc
            end if
            if the name extension of aFile is "mkv" then
                move aFile to Movies
            end if
        end repeat
    end tell
end adding folder items to

答案1

尝试:

on adding folder items to this_folder after receiving added_items
    tell application "System Events"
        repeat with aFile in added_items
            if the name extension of aFile is "mp3" then
                move aFile to "/Users/davidcuster/Music"
            else if the name extension of aFile is "mkv" then
                move aFile to "/Users/davidcuster/Movies"
            end if
        end repeat
    end tell
end adding folder items to

还:

“/Users/davidcuster/Music” =(音乐文件夹路径)

“/Users/davidcuster/Movies” =(电影文件夹的路径)

  on adding folder items to this_folder after receiving added_items
    tell application "System Events"
        repeat with aFile in added_items
            if the name extension of aFile is "mp3" then
                move aFile to path to music folder
            else if the name extension of aFile is "mkv" then
                move aFile to path to movies folder
            end if
        end repeat
    end tell
end adding folder items to

相关内容