Re: Applescripting an export from Palm for FIleMaker
Re: Applescripting an export from Palm for FIleMaker
- Subject: Re: Applescripting an export from Palm for FIleMaker
- From: "Jason W. Bruce" <email@hidden>
- Date: Mon, 14 May 2001 16:15:39 +0000
>
Date: Sat, 12 May 2001 10:00:54 -0700
>
From: KS Creative Design <email@hidden>
>
Subject: Re: Applescripting an export from Palm for FIleMaker
>
Cc: Applescript-Users <email@hidden>
>
To: "Jason W. Bruce" <email@hidden>, Chris Page
>
<email@hidden>
>
>
Hey Jason (and Chris Page lead Mac guy over at Palm Desktop land)
>
>
Thanks for the good info. I've managed to script Exports in FileMaker
>
from a monolithic Accounting package, that exactly match the import
>
structures in Palm (at least on the Mac side) for ALL four of the main
>
modules (contacts, tasks, memos, and even calendar). The part I want to
>
do is automate it (and take user error our of the loop of having a
>
person have to manually open the Palm->File->import command...) IMPORT
>
doesn't even seem to be an option in the dictionary for Palm Desktop.
>
>
Also, HOW problematic is the EXPORT command?
>
Triggering the addresses one at a time may be a way to go, do you have
>
an example script of how to coerce data from Palm to list to tab
>
delineated text and into FileMaker. Not to mention having FileMaker
>
return contents of Portals as AppleScript lists.
Hi Kent,
No user interaction is required to go in either direction. The export
command I don't think is usable. Here is basically how I do it. This is
stripped down (and therefore untested) so you may have to fiddle around with
it a bit.
To getrecords()
tell application "FileMaker Pro"
set foundset to fields of document "Contacts"
return foundset
end tell
end getrecords
To SendToPilot(foundset)
set upperlimit to count of items of foundset
repeat with counter from 1 to upperlimit
set x to item counter of foundset
set firstname to item 1 of x
set lastname to item 2 of x
tell application "Palm Desktop"
create new address with {name info:{first name:firstname,last
name:lastname}}
end tell
end repeat
end SendToPilot
getrecords()
set foundset to the result
SendToPilot(foundset)
To go from Palm to FileMaker:
tell application "Palm Desktop"
set upperlimit to count of every address
repeat with loopvariable from 1 to upperlimit
set firstname to first name of address loopvariable
set lastname to last name of address loopvariable
SendToFileMaker(firstname,lastname) of me
end repeat
end tell
To SendToFileMaker(firstname,lastname)
tell application "FileMaker Pro"
tell document "Contacts"
create new record with data {firstname,lastname}
end tell
end tell
end SendToFileMaker
You can use a script scheduler to trigger these scripts at regular
intervals. Below is another script which writes FileMaker records,
including portals, into Palm memos -- 1 memo for each FileMaker record.
tell application "FileMaker Pro"
set upperlimit to count of records of document "Matters"
repeat with counter from 1 to upperlimit
go to layout "Form View - All Parties Telephone" of document
"Matters"
set labelRecord to name of every cell of record counter of document
"Matters" -- field names
set NoteRecord to every cell of record counter of document "Matters"
set modificationDate to cell "Date Modified" of record counter of
document "Matters"
set upperlimit to count of items of NoteRecord
repeat with loopvariable from 1 to upperlimit
if class of item loopvariable of NoteRecord is list then -- if
the item is a list then it is a Filemaker portal
set NoteRecordUpperLimit to count of items of (item
loopvariable of NoteRecord) -- if its a portal then count the rows
set portalrecord to ""
repeat with NoteRecordloopvariable from 1 to
NoteRecordUpperLimit
set portalrecord to portalrecord & (item
NoteRecordloopvariable of item loopvariable of NoteRecord & " ")
end repeat -- inserts a tab after each portal cell
set (item loopvariable of NoteRecord) to portalrecord
end if
set item loopvariable of labelRecord to item loopvariable of
labelRecord & " " & item loopvariable of NoteRecord & "
" & "
" -- this creates a tab delimited paragraph for each (verticle) column in
the Filemaker portal and inserts carriage return after
end repeat
set newNote to labelRecord as string
set categoryvariable to cell "Matter Name" of record counter of
document "Matters"
my createNewNote(categoryvariable, newNote, modificationDate)
end repeat
end tell
to createNewNote(categoryvariable, newNote, modificationDate)
tell application "Palm Desktop"
create new memo with {title:categoryvariable, creation