我試圖從終端運行AppleScript腳本,但我不能得到它通過調用打印到標準輸出使用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
標籤是不是真的出了好這個:(
可能的重複[從osascript/Applescript打印到標準輸出](http://stackoverflow.com/questions/8766868/print-to-stdout-from-osascript-applescript) – 2013-11-14 09:34:30