I’m trying to add a multiline text str as a value of a field in Appleworks 6 database, but no matter what I do it removes the line returns.
tell application "Appleworks 6"
set doc to front document
set r to (make new record in doc)
set value of field "CompanyAddress" of current record of doc to "Some Company\rAddr1\rAddr2"
end tell
the field in appleworks becomes Some Company Addr1 Addr2
AppleWorks’ scripting was still buggy when they stopped updating it. As a workaround, you could use ui scripting. Something like this:
tell application "AppleWorks 6"
activate
set r to (make new record at front document)
set current record of front document to r
end tell
set t to "000" & return & "111"
set tk to ASCII character 9
tell application "System Events"
tell process "AppleWorks 6"
keystroke tk -- tab to first field of new record
keystroke "a" with command down -- select all text
keystroke t -- replace
end tell
end tell
Edited: in the ‘keystroke’ command, change ‘with’ to using in post Jaguar OS.