Re: import picture to FMP?
Re: import picture to FMP?
- Subject: Re: import picture to FMP?
- From: Jean-Marie Hoornaert <email@hidden>
- Date: Fri, 19 Jul 2002 12:17:38 +0200
Le vendredi 19 juillet 2002 a 3:45, Mario Kolaszewski a ecrit :
>
Is there a way to import a picture into
>
a FMP record using AS?
Needs FileMaker Pro 5 minimum.
3 fields : 1 = text ; 2 = text ; 3 = container
To import a single picture :
(* script "single picture" *)
set picturePath to (choose file with prompt ,
"select a picture" of type {"PICT", "GIFf", "JPEG"})
set {OATID, AppleScript's text item delimiters} to ,
{AppleScript's text item delimiters, ":"}
set pictureName to (last item of (text items of ,
(picturePath as string)) as string)
set pictureFolder to ((((items 1 thru -2 of ,
(text items of (picturePath as string))) as string) & ":") ,
as string)
set AppleScript's text item delimiters to OATID
tell application "Finder" to set ,
pictureType to file type of picturePath
open for access file picturePath
set thePicture to read file picturePath as pictureType
close access file picturePath
tell application "FileMaker Pro" to ,
create new record with data ,
{pictureName, pictureFolder, thePicture}
(* end script *)
to import "batch" all pict, gif and jpeg from a folder and subfolders
(use Tanaka's osax)
(* script "import batch" *)
set avableTypes to {"PICT", "GIFf", "JPEG"}
set theFolder to choose folder
set listPictures to (MT List Files theFolder of type ,
avableTypes return as alias with sub folders) -- Tanaka's osax
repeat with thePicturePath in listPictures
set {OATID, AppleScript's text item delimiters} to ,
{AppleScript's text item delimiters, ":"}
set pictureName to (last item of (text items of ,
(thePicturePath as string)) as string)
set theFolder to ((((items 1 thru -2 of ,
(text items of (thePicturePath as string))) as string) & ":") as string)
set AppleScript's text item delimiters to OATID
set pictureType to ,
MT Get Info thePicturePath about file_type -- Tanaka's osax
if pictureType is in avableTypes then
open for access file thePicturePath
set thePicture to read file thePicturePath as pictureType
close access file thePicturePath
tell application "FileMaker Pro" to ,
create new record with data {pictureName, theFolder, thePicture}
end if
end repeat
(* end script *)
--
Cordialement.
Jean-Marie -HOO;-)
____________________
Jean-Marie Hoornaert
Courriel : email@hidden
PPsP* :
http://www.h2o.be
Newsletter : email@hidden?subject=abonnement_h2o
* Page Personnelle sans Pritention
* pour AppleScripter FileMaker
_______________________________________________
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.