Re: export AppleWorks database to spreadsheet
Re: export AppleWorks database to spreadsheet
- Subject: Re: export AppleWorks database to spreadsheet
- From: kai <email@hidden>
- Date: Wed, 30 Mar 2005 03:27:49 +0100
On Tue, 29 Mar 2005 20:10:05 +0100, MARIAM A CHERIAN wrote:
Has anybody come across a script that will export selected fields and
their contents form an appleworks database into a spreadsheet for a
year's range of records?
Any help much appreciated.
I don't recall having come across one, Abraham - but it shouldn't be
too difficult to cobble one together, just to get you started.
The following example doesn't attempt to do anything too ambitious or
fast. It simply takes selected data from the first available database
and inserts it into a new spreadsheet document. It doesn't even attempt
any formatting - apart from adjusting column widths to fit.
Anyway, it might give you a few ideas.
Since a few of the lines are quite long, you may have to rejoin any
that get wrapped when posting:
-------------------
property defFields : {}
tell application "AppleWorks 6"
activate
tell (first document whose document kind is database document)
set dName to name
set fName to name of fields
tell (choose from list fName with prompt "Choose the \"" & dName &
"\" fields that you wish to export:" default items defFields with
multiple selections allowed) to if it is false then
error number -128
else
set defFields to it
end if
set dataList to {}
repeat with f in defFields
tell field (f's contents) to set dataList's end to {name} & value
end repeat
end tell
set rowCount to count dataList's item 1
tell (make new document with properties {document kind:spreadsheet
document})
repeat with c from 1 to (count dataList)
tell column c to repeat with r from 1 to rowCount
set row r to item r of item c of dataList
end repeat
end repeat
repeat with n from 1 to c
select column n
tell application "System Events" to tell process "AppleWorks 6" to
click menu item "Autosize Columns" of menu "Format" of menu bar 1
end repeat
select cell 1
end tell
end tell
-------------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden