Answer: SQLite in Applescript

Applescript SQL DiagramThanks to responses on a post thread I made over at MacScripter I now have a lead on integrating SQLite db's into my applescripts.

b.visser discovered:

There is a faceless app called 'Database Events'. You can find it by opening a new dictionary from the file menu.

Special thanks to guardian34, a little diagram and applescript example helps illustrate the point.

set theFolder to choose folder
tell application "Database Events"
set theDB to make new database ¬
with properties {name:"Test", location:theFolder}
tell theDB
set theRecord to make new record ¬
with properties {name:"SomeRecord", id:1}
end tell
tell theRecord
set field1 to make new field ¬
with properties {name:"ID", value:1}
set field2 to make new field ¬
with properties {name:"Name", value:"foo"}
end tell

return {(value of field1), (value of field2)}
end tell

Unfortunately, I don't have a cool script/CSS design for prettifying Applescript code, so you'll have to deal with the monochromed type.

About this article

written on
posted in ProgrammingApple Back to Top

About the Author

Andrew Turner is an advocate of open standards and open data. He is actively involved in many organizations developing and supporting open standards, including OpenStreetMap, Open Geospatial Consortium, Open Web Foundation, OSGeo, and the World Wide Web Consortium. He co-founded CrisisCommons, a community of volunteers that, in coordination with government agencies and disaster response groups, build technology tools to help people in need during and after a crisis such as an earthquake, tsunami, tornado, hurricane, flood, or wildfire.