1

したがって、あるフォルダーのすべてのコンテンツのエイリアスを別のフォルダーに作成するためのこの AppleScript があります。

ソース フォルダーにアイテムが 1 つしかない場合を除き、完全に機能します。

tell application "Finder"
    set SourceFolder to (choose folder with prompt "Please choose Source folder:") as string
    set DestinationFolder to (choose folder with prompt "Choose Destination folder for aliases:") as string
    set theFolders to every item of entire contents of folder SourceFolder
    repeat with thisFolder in theFolders 
        set thisName to name of thisFolder
        make new alias file at folder DestinationFolder to thisFolder without invisibles
    end repeat
end tell

アイテムが1つしかないのに、なぜ何も得られないのか考えていますか? ソース フォルダーに少なくとも 2 つのアイテムがある場合、宛先に両方のエイリアスが作成されます。

余談ですが、実行時にソース フォルダーと宛先フォルダーを記憶させる方法はありますか?

4

1 に答える 1

0

試す:

property SourceFolder : missing value
property DestinationFolder : missing value

if SourceFolder = missing value then
    set SourceFolder to (choose folder with prompt "Please choose Source folder:")
    set DestinationFolder to (choose folder with prompt "Choose Destination folder for aliases:")
else

    tell application "Finder"
        set theFolders to every item of entire contents of SourceFolder as list
        repeat with thisFolder in theFolders
            make new alias file at DestinationFolder to thisFolder
        end repeat
    end tell
end if
于 2012-10-02T16:56:25.043 に答える