我正在尝试从终端运行 AppleScript 脚本,但是我无法通过调用它来打印任何内容
osascript myFile.scpt "/path/to/a/file"
我正在努力:
on run fileName
set unique_songs to paragraphs of (read POSIX file fileName)
repeat with nextLine in unique_songs
if length of nextLine is greater than 0 then
set AppleScript's text item delimiters to tab
set song to text item 2 of nextLine
set artist to text item 3 of nextLine
set album to text item 4 of nextLine
set output to ("Song: " & song & " - " & artist & " - " & album)
copy output to stdout
end if
end repeat
end run
制表符分隔文件的格式如下:
1282622675 Beneath the Balcony Iron & Wine The Sea & the Rhythm
1282622410 There Goes the Fear Doves (500) Days of Summer
1282622204 Go to Sleep. (Little Man Being Erased.) Radiohead Hail to the Thief
选项卡在此方面并没有很好地显示:(