0

私はCSVの1行を取り、そこから1つのアイテムを抽出しようとしています:

tell application "Finder"
    set workingFile to (open for access outPath)
    set theContents to read workingFile using delimiter {ASCII character 13} as list
end tell

set rowTwo to item 2 of theContents as list
close access workingFile

set AppleScript's text item delimiters to {","}
set rowParts to (every text item in rowTwo) as list

display dialog rowParts

set secondItem to item 2 of rowParts


display dialog "The second item is:  " & secondItem

プログラムを実行しようとすると、次のエラーが発生しますset secondItem to item 2 of rowParts

Result:
error "Can’t get item 2 of {\"Date,Day,Zimmer,Graves,Randolph,Dempsey,Hannah,DeVaughn,,GSA 0034G,GSA 0035G,48' Trailer1,48' Trailer2,53' Trailer\"}." number -1728 from item 2 of {"Date,Day,Zimmer,Graves,Randolph,Dempsey,Hannah,DeVaughn,,GSA 0034G,GSA 0035G,48' Trailer1,48' Trailer2,53' Trailer"}

そのエラーが発生する理由を誰か教えてもらえますか?

4

1 に答える 1

0

変数は、リストではなく文字列rowTwoでなければなりません。as list

as list他の行では役に立たない。

set theContents to read outPath using delimiter (ASCII character 13)
set rowTwo to item 2 of theContents
set AppleScript's text item delimiters to ","
set rowParts to text items of rowTwo
set secondItem to item 2 of rowParts
display dialog "The second item is:  " & secondItem
于 2012-07-21T03:45:41.190 に答える