0
我有一個腳本,用您選擇的圖像來更改文件夾的圖標,它工作正常,但我希望能夠讓腳本自動選擇第一張圖像該文件夾並將其指定爲將用於創建圖標的圖像。選擇在Fiinder中選擇的文件夾中的第一個圖像
這是我到目前爲止。它無法選擇圖像,並根據我的嘗試給出各種錯誤消息。任何幫助將不勝感激!
set exePath to (path to home folder as text) & "downloads:SetFileIcon"
tell application "Finder"
set theSelection to selection -- This is a list of selected items, even if only 1 item is selected.
set theFile to (item 1 of theSelection) as text -- Get the first item in the list. We make it text so we can convert it to a posix path for SetFileIcon.
set theimage to item 1 of theSelection
set imagePath to (path to desktop folder as text) and theimage
end tell
do shell script quoted form of POSIX path of exePath & " -image " & quoted form of POSIX path of imagePath & " -file " & quoted form of POSIX path of theFile