[Pythonmac-SIG] Re: FileMaker Pro and Python

Vincent Marchetti vincem@en.com
Tue, 3 Apr 2001 21:30:05 -0400


Reply to Lane concerning scripting FileMaker Pro from Python. -- I do 
not use FileMaker Pro, and
know nothing about the module FMPro, but I have some suggestions for 
working with the Python module
generated by gensuitemod.py:

At 2:42 PM -0400 4/2/01, Advertising wrote:
>I attempted to start by using the lib-scriptpackage created by
>MacPython2.0's getsuitemodule.py
>Unfortunately it created so much code, I couldn't tell how to access
>anything.
>(This is much, much, deeper than my beginner Python Books cover)
>
>Using AppleScript I would.....
>
>      Tell Application "FileMakerProv4.1"
>    	    	set myVar to cell 21 of record 1 of database 1
>		  	     show (every record of database 1 whose 
>cell "modificationDate"
>is greater than myVar)
>      end tell

At 2:42 PM -0400 4/2/01, Advertising wrote:
>Using macPython I tried.......
>
>        import FileMaker
>     		dataPuller = FileMaker.FileMaker(start=1)
This looks OK , I assume that at this point the FileMaker Pro app has launched.

At 2:42 PM -0400 4/2/01, Advertising wrote:
>       listOitems = dataPuller.database    ##doesn't work, Can't even get
>access to the database

Try:
listOitems = dataPuller._get(FileMaker.database())
## you are 'getting' the object database. However, it is up to the 
app FMPro as to what you get
## back, you may get an object reference or you may get a ton of data 
in a mysterious format

For the equivalent of the AppleScript
set myVar to cell 21 of record 1 of database 1

try in  Python
from FileMaker import cell, record, database
myVar = dataPuller._get(cell(21, record(1, database())))

This MIGHT also work
myVar = dataPuller._get(database().record(1).cell(21))

If this appears to work for you, and you're interested, I can dig up 
my example code of how I passed
the whose clause in an object reference, to implement the last line 
of your AppleScript.

Vince Marchetti