Re: Export Image From FileMaker
Re: Export Image From FileMaker
- Subject: Re: Export Image From FileMaker
- From: Simon Forster <email@hidden>
- Date: Tue, 11 Nov 2003 18:48:04 +0000
On 11 Nov 2003, at 16:51, christian vick wrote:
Not only boring, but also not save since the clipboard could change...
I just had today the same problem. In the past i've used clip2gif, a
nifty
application which did a great job on this, but it's an OS 9 app and i
want
to say goodbye to Classic...
Doesn't clip2gif simply convert the contents of the clipboard to a gif
- thus not addressing your concern wrt using the clipboard?
FWIW, Dave Dowling kindly sent me a script which copies from FileMaker
to the clipboard and then uses Graphic Converter's "new image from
clipboard" to create a new image. After that, all was plain sailing.
However, spurred on by your example, I revisited my first attempt which
just copies straight from an FMP container field to a file. This failed
yesterday resulting in much wailing and gnashing of teeth, especially
because:
- It's so simple and should have worked
- The first script I wrote became irredeemably corrupted. Indeed I
wonder if these 2 things aren't linked - the script was displaying
weird behaviour like not seeing Standard Additions.
Anyhoo. A quick tweak of my Graphic Converter script and - done. Loop
through the database copying any figure direct to disk. No third party
apps required. The files display in the Finder as generic plain text
icons but this is not a problem (to me). Drop on Graphic Converter and
there are the pics.
This whole exercise was totally academic as I'd already done it (using
GC and the clipboard). Further, I need the images for the web so I'd
still need to convert them to jpegs. But it works so I'm happy.
The quick "direct to disk, do not pass the clipboard" script I ended up
with is below the sig if you're interested.
ATB
Simon Forster
____________________________________________
LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
Tel: +44 (0)70 9230 5244 Fax: +44 (0)70 9230 5247
____________________________________________
set theDatabase to text returned of (display dialog "From which
database do you wish to export the pics?" default answer "blah.fp5")
set theLayout to text returned of (display dialog "From which layout do
you wish to export the pics?" default answer "blah")
set firstFieldName to text returned of (display dialog "From which
field do we get the picture's name?" default answer "blah")
set secondFieldName to text returned of (display dialog "Is there an
additional field to use in the picture's name?" default answer "blah")
set imageFieldName to text returned of (display dialog "And from from
which field do you wish to export the pics?" default answer "Figure")
set folderPath to (choose folder with prompt "In which folder do you
wish to save the pics?")
tell application "FileMaker Developer"
tell document theDatabase
go to layout theLayout
repeat with i from 1 to count of records
tell record i
set theFileName to (folderPath as string) & (get data cell
firstFieldName)
if length of secondFieldName > 0 then set theFileName to
theFileName & "_" & (get data cell secondFieldName)
set theFileName to theFileName & ".jpeg"
go to cell imageFieldName
copy
end tell
tell me to resizeAndSave(theFileName)
end repeat
end tell
end tell
on saveit(theFile, thePic)
try
set fileRef to open for access theFile with write permission
write thePic to fileRef starting at 0
close access fileRef
on error errorMsg number errorNumber
close access fileRef
display dialog errorMsg & " (" & errorNumber & ")"
end try
end saveit
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.