私のオフィスがスケジュールに使用するスプレッドシートがあります。各タブは月を表します。各タブをmonth1.csv、month2.csv...などの名前のファイルにエクスポートできます。各月のファイルを開いてループするための次のコードがあります。
repeat with b from 1 to 12
tell application "Finder"
set curFileName to (sourceFolder & "month" & b & ".csv") as string
--display dialog curFileName
set workingFile to read file (curFileName)
--display dialog "File has been read"
set AppleScript's text item delimiters to {ASCII character 13}
set theContents to text items of workingFile as list
end tell
do stuff with the csv...
end repeat
スクリプトは最初の月を繰り返し、b=2のときに次のエラーが発生します。
Finder got an error: File file Macintosh HD:Users:lorenjz:Documents:Manpower:,month,2,.csv wasn’t found.
このエラーを解消するにはどうすればよいですか?