Mac OS X 10.7 (ビルド: 11A511) Lion で AppleScript 2.2 を使用して AppleScript アプリケーションを作成しています。私のアプリケーションが行っているのは、現在の iTunes の曲をキャプチャし、曲が最後の曲と異なる場合に保存することです。次に、現在の曲を取得し、Database Events を使用して SQLite ファイルに配置するように指示しました。基本的には、現在の曲を新しいフィールドに追加しますが、曲が変更されると、古いフィールドがないと言って曲を書き込みます (プロセスが繰り返されます...)。それがフィールドを作った後、私はセーブを持っています。
私のコードは次のとおりです。
if currentsong is not equal to previous_song then
tell application "Database Events"
tell database "songlist"
set song to make new record with properties {name:"songs"}
set song_count to count fields
tell song
make new field with properties {name:currentsong, value:song_count + 1}
end tell
end tell
save database "songlist"
end tell
end if