Applescriptのベローは、あなたが望むことをします。
私はそれを明確にするためにいくつかのコメントを追加しました:そんなに
set FCsv to choose file with prompt "Select your CSV file with students"
set Dest to choose folder with prompt "Select master folder"
set FPDF to choose file with prompt "Select your PDF file"
tell application "Finder" to set PdfName to name of FPDF
set PdfName to text 1 thru ((offset of ".pdf" in PdfName) - 1) of PdfName -- get PDF name without .pdf extension
set Fcontent to read FCsv -- read all cvs file
set FLines to every paragraph of Fcontent
repeat with aStudent in FLines -- loop through each line of the cvs file
tell application "Finder"
try -- try to create folder Student in master folder : assumption, it does not exist before !
set SubFolder to make new folder in Dest with properties {name:aStudent}
end try
set SFolder to SubFolder as string
-- use 'cp' shell command to copy with new name
do shell script "cp " & (quoted form of (POSIX path of FPDF)) & " " & (quoted form of ((POSIX path of SFolder) & PdfName & "-" & aStudent & ".pdf"))
end tell
end repeat
感謝を。私が必要とするように正確に動作します! –